예제 #1
0
 public static bool VerifyHashedPassword(this string hashedPassword, string plainPassword)
 {
     byte[] buffer4;
     if (hashedPassword == null)
     {
         return(false);
     }
     if (plainPassword == null)
     {
         throw new ArgumentNullException("plainPassword");
     }
     byte[] src = Convert.FromBase64String(hashedPassword);
     if ((src.Length != 0x31) || (src[0] != 0))
     {
         return(false);
     }
     byte[] dst = new byte[0x10];
     Buffer.BlockCopy(src, 1, dst, 0, 0x10);
     byte[] buffer3 = new byte[0x20];
     Buffer.BlockCopy(src, 0x11, buffer3, 0, 0x20);
     using (Rfc2898DeriveBytes bytes = new Rfc2898DeriveBytes(plainPassword, dst, 0x3e8))
     {
         buffer4 = bytes.GetBytes(0x20);
     }
     return(Comparers.ByteArraysEqual(buffer3, buffer4));
 }