?
Das hab ich mal zusammengefrickelt:
//---------------------------------------------------------------------------
#pragma hdrstop
#include <SysUtils.hpp>
#include <stdio.h>
#include <sys\stat.h>
//---------------------------------------------------------------------------
typedef unsigned char exByte;
#pragma argsused
int main(int argc, char* argv[])
{
char *key;
key="myKey";
FILE* pSourceFile = 0;
FILE* pDestFile = 0;
pSourceFile = fopen(argv[1] , "rb");
struct stat sz;
stat(argv[1] , &sz);
exByte *src = (exByte*)malloc(sz.st_size);
fread (src , 1 , sz.st_size , pSourceFile);
fclose(pSourceFile);
int keyLen=strlen(key);
int CPos=0;
int srcValue=0;
int keyPos=0;
int CKey=0;
int NKey=0;
int dstValue;
for(;CPos<sz.st_size;CPos++)
{
srcValue=src[CPos];
keyPos++;
if(keyPos==keyLen)keyPos=1;
CKey=key[keyPos];
NKey=key[keyPos+1];
asm{
mov eax, srcValue
mov ebx,key
xchg bl,bh
xor eax,ebx
xor eax,NKey
not ax
mov dstValue,eax
}
src[CPos]=dstValue;
}
pDestFile = fopen(argv[2] , "wb");
fwrite(src , 1 , sz.st_size , pDestFile);
free(src);
fclose(pDestFile);
return 0;
}
//---------------------------------------------------------------------------
Wie gesagt, ziehmlich gefrickelt^^
aber trotzdem:
hoffe, es hilft!