SHARE
TWEET

decrypt

a guest Aug 26th, 2012 535 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void __stdcall decrypt(char* Buf, unsigned int BufLen, char* Key)
  2. {
  3.   BYTE keyLen, tmpByte;
  4.   unsigned int i, j;
  5.   BYTE codeTable[256];
  6.  
  7.  
  8.   keyLen = strlen(Key);
  9.  
  10.   if ( keyLen > 0 )
  11.   {
  12.     for (i = 0 ; i < 256 ; i++)
  13.         {
  14.                 codeTable[i] = i;
  15.         }
  16.     BYTE loc = 0, loc1 = 0;
  17.     for ( i = 0; i < 256; ++i )
  18.     {
  19.       loc = (BYTE)loc + codeTable[i] + *(BYTE *)(Key + i % keyLen);
  20.       tmpByte = codeTable[loc];
  21.       codeTable[loc] = codeTable[i];
  22.       codeTable[i] = tmpByte;
  23.     }
  24.         loc = 0;
  25.         loc1 = 0;
  26.     for ( j = 0; BufLen > j; ++j )
  27.     {
  28.       loc += 1;
  29.       loc1 = loc1 + codeTable[loc];
  30.       tmpByte = codeTable[loc1];
  31.       codeTable[loc1] = codeTable[loc];
  32.       codeTable[loc] = tmpByte;
  33.           tmpByte = codeTable[loc1] + tmpByte;
  34.       Buf[j] ^= codeTable[tmpByte];
  35.     }
  36.   }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top