Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 17:16

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Crash while Encrypt Aes

Discussion on Crash while Encrypt Aes within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
Lazeboy's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 451
Received Thanks: 410
Crash while Encrypt Aes

Hi,
i think the problem is that i use strcat und malloc but what exactly the problem is i dont know.....

Code:
// Aes Encrypt.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "Rijndael.h"
#include <fstream>
#include <iostream>
using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
	CRijndael Rij;
	char DecryptStr[16] = {0};
	char DecryptedStr[20] = {0};
	char filestr[999999] = {0};
	Rij.MakeKey("123456789",CRijndael::sm_chain0, 16,16);

	FILE *filein;
	filein = fopen(argv[1],"rb");
	fseek(filein,0,SEEK_END);
	int size = ftell(filein);
	rewind (filein);
	fseek(filein,0,SEEK_SET);
	char *bufin = (char*)malloc(sizeof(char)*size+1);
	memset(bufin,0,sizeof(char)*size);
	fread(bufin,1,size,filein);

	FILE *fileout;
	char outputname[999] = {0};
	sprintf(outputname,"%s.set",argv[1]);
	fileout = fopen(outputname,"a+");

	//für ft
	
	char bla[9999999] = {0};
  	for(int i = 0;i < (size);i+=16)
  	{
  		Rij.Encrypt(bufin+i, filestr,16);
  		strcat(bla,filestr);
 	}
	for(int i = 0;i < (size);i++)
	{
		bla[i+1] = bla[i];
	}
 	bla[0] = 0x0b;
 	fwrite(bla,1,(size+1),fileout);
	fclose(filein);
	fclose(fileout);
	free(bufin);
	cout << "fertig";
	cin.get();
	return 0;
}
Lazeboy is offline  
Reply


Similar Threads Similar Threads
Crash while Encrypt Aes
02/28/2011 - General Gaming Discussion - 3 Replies
Close
Encrypt/Decrypt
09/01/2010 - EO PServer Hosting - 9 Replies
Who can tell me how can i decrypt a password mage by the register page?:D
hey can any one encrypt
10/20/2007 - Kal Online - 1 Replies
hey can any one encrypt this jobsystem-e



All times are GMT +1. The time now is 17:18.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.