// xor byte.cpp : Defines the entry point for the console application.
// © heroich.net 20150227
#include "stdafx.h"
DWORD XorEncryp (DWORD vals, DWORD key)
{
BYTE * pbyte = (BYTE *) &vals;//misah DWORD ke array byte[]
BYTE x[4];
//tiap byte di xor
for(int i=0;i<4;i++)
{
x[i]=pbyte[i]^key;
}
printf( "x: %X \n" ,x[0]);
printf( "x: %X \n" ,x[1]);
printf( "x: %X \n" ,x[2]);
printf( "x: %X \n" ,x[3]);
return (x[0]) | (x[1] << 8) | (x[2] << 16) | (x[3] << 24);//gabung byte array to dword
}
int _tmain(int argc, _TCHAR* argv[])
{
DWORD dwValues = 0x0BDFA4;//ofset adr DWORD apa aja
DWORD ky= 0xC3;//key apa aja
DWORD encrypted = XorEncryp(dwValues ,ky);
printf( "Encrypted:%08X \n" ,encrypted);
DWORD decrypted = XorEncryp(encrypted,ky);
printf( "decrypted:%08X \n" ,decrypted);
system("pause");
return 0;
}
Langganan:
Posting Komentar (Atom)
0 Response to "[C++]DWORD xor Encrypt Simple Mode"
Posting Komentar