Beispiel #1
0
 private static byte[] intermediateSum(HashAlgorithm algorithm, byte[] password, byte[] magic, byte[] salt, byte[] alternateSum)
 {
     algorithm.Initialize();
     algorithm.AddToDigest(password);
     algorithm.AddToDigest(magic);
     algorithm.AddToDigest(salt);
     algorithm.AddToDigestBuffered(alternateSum, password.Length);
     byte[] temp = new byte[1];
     for (int i = password.Length; i != 0; i >>= 1)
     {
         if ((i & 1) != 0)
         {
             temp[0] = 0;
         }
         else
         {
             temp[0] = password[0];
         }
         algorithm.AddToDigest(temp);
     }
     return(algorithm.FinalizeAndGetHash());
 }
Beispiel #2
0
 public static void AddToDigestBuffered(this HashAlgorithm algorithm, byte[] inputBuffer, int outputLength)
 {
     algorithm.AddToDigestBuffered(inputBuffer, 0, inputBuffer.Length, outputLength);
 }