Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. public static byte[] KEY = Encoding.ASCII.GetBytes("unknownkey");
  2.  
  3. static public void Encrypt(byte[] Buffer)
  4. {
  5.     byte Incrementor = Buffer[4];
  6.  
  7.     int Group = 0;
  8.     int GroupCount = 0;
  9.     for (int i = 5; i < Buffer.Length; i++)
  10.     {
  11.         int keyPoint = ((i - 5) % KEY.Length); // First Stage
  12.         Buffer[i] ^= KEY[keyPoint];
  13.  
  14.         byte KeyVal = (byte)(Group % 256); // Second Stage
  15.         if (KeyVal != Incrementor)
  16.         {
  17.             Buffer[i] ^= KeyVal;
  18.         }
  19.  
  20.         Buffer[i] ^= Incrementor; // Third Stage
  21.  
  22.         GroupCount++;
  23.         if (GroupCount == KEY.Length)
  24.         {
  25.             Group++;
  26.             GroupCount = 0;
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement