kill_seth

Diablo 3 Encryption

Oct 11th, 2013
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.41 KB | None | 0 0
  1.     /// <summary>
  2.     /// Diablo 3 Encryption
  3.     /// Reversed by Vulnavia
  4.     /// Implemented by kill_seth
  5.     /// </summary>
  6.     public class Diablo3_uint64
  7.     {
  8.         /// <summary>
  9.         /// Decrypts diablo 3 encrypted saves.
  10.         /// </summary>
  11.         public static byte[] Decrypt(byte[] data)
  12.         {
  13.             try
  14.             {
  15.                 UInt64 Key = 0x2EC9A01B305F92D8;
  16.                 for (int i = 0; i < data.Length; i++)
  17.                 {
  18.                     data[i] = (byte)((data[i] ^ (Key & 0xFF)) & 0xFF);
  19.                     Key = ((Key ^ data[i]) << 56) | (Key >> 8);
  20.                 }
  21.                 return data;
  22.             }
  23.             catch (Exception ex)
  24.             {
  25.                 throw ex;
  26.             }
  27.         }
  28.  
  29.         /// <summary>
  30.         /// Encrypts diablo 3 decrypted saves.
  31.         /// </summary>
  32.         public static byte[] Encrypt(byte[] data)
  33.         {
  34.             try
  35.             {
  36.                 UInt64 Key = 0x2EC9A01B305F92D8;
  37.                 for (int i = 0; i < data.Length; i++)
  38.                 {
  39.                     byte temp = data[i];
  40.                     data[i] = (byte)((temp ^ (Key & 0xFF)) & 0xFF);
  41.                     Key = ((Key ^ temp) << 56) | (Key >> 8);
  42.                 }
  43.                 return data;
  44.             }
  45.             catch (Exception ex)
  46.             {
  47.                 throw ex;
  48.             }
  49.         }
  50.     }
Advertisement
Add Comment
Please, Sign In to add comment