private static string GeneratePasswordHashV0(PasswordRequestv0 request) { Validation.IsNotNull(request, "request"); var hashSalt = GenerateRandomToken(); return($"{ComputeHashV0(request)}:{hashSalt}"); }
/// <summary> /// /// </summary> public static string ComputeHashV0(PasswordRequestv0 request) { Validation.IsNotNull(request, "request"); using (SHA1 sha = new SHA1CryptoServiceProvider()) { var p1 = Convert.FromBase64String(request.HashSalt); var p2 = System.Text.Encoding.Unicode.GetBytes(request.PlainPassword); var data = new byte[p1.Length + p2.Length]; p1.CopyTo(data, 0); p2.CopyTo(data, p1.Length); return(Convert.ToBase64String(sha.ComputeHash(data))); } }