kill_seth

Tales of Zestiria Checksum

Oct 31st, 2015
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1.     /*
  2.      * Tales of Zestiria Checksum
  3.      * Reversed by Vulnavia
  4.      * Implemented by kill_seth
  5.      * Checksum stored at 0x514
  6.      * Checksum covers 0x6D8 -> Size(0x9BA00)
  7.      */
  8.     public class SHA1_TOZ
  9.     {
  10.         public static byte[] Compute(byte[] data)
  11.         {
  12.             string key = "TO12";
  13.             string[] keys = { "SRA", "ROS", "MIC", "LAI", "EDN", "DEZ", "ZAB", "ALI" };
  14.             byte[] hash = Compute(data, Encoding.ASCII.GetBytes(key));
  15.             int x = 0;
  16.             for (int i = 0; i < 100; i++)
  17.             {
  18.                 hash = Compute(hash, Encoding.ASCII.GetBytes(keys[x++]));
  19.                 if (x > 7) x = 0;
  20.             }
  21.             return hash;
  22.         }
  23.  
  24.         private static byte[] Compute(byte[] data, byte[] key)
  25.         {
  26.             SHA1CryptoServiceProvider sha = new SHA1CryptoServiceProvider();
  27.             sha.TransformBlock(data, 0, data.Length, data, 0);
  28.             sha.TransformFinalBlock(key, 0, key.Length);
  29.             return sha.Hash;
  30.         }
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment