public HashRaw ( byte password, byte salt ) : byte[] | ||
password | byte | |
salt | byte | |
리턴 | byte[] |
private static void Run(PasswordHasher hasher, string pwd, string salt, bool rawOnly, bool encodedOnly) { try { if (rawOnly) { Console.WriteLine(ToHex(hasher.HashRaw(pwd, salt))); return; } if (encodedOnly) { Console.WriteLine(hasher.Hash(pwd, salt)); return; } var startTime = DateTime.Now; string encoded = hasher.Hash(pwd, salt); var stopTime = DateTime.Now; HashMetadata metadata = PasswordHasher.ExtractMetadata(encoded); Console.WriteLine("Hash:\t\t" + ToHex(metadata.Hash)); Console.WriteLine("Encoded:\t" + encoded); Console.WriteLine("{0:0.000} seconds", (stopTime - startTime).TotalSeconds); if (hasher.Verify(encoded, pwd)) { Console.WriteLine("Verification ok"); } else { throw new Argon2Exception("verifying", Argon2Error.VERIFY_MISMATCH); } } catch (Exception ex) { Fatal(ex.Message); } }
private static void Run(PasswordHasher hasher, string pwd, string salt, bool rawOnly, bool encodedOnly) { try { if (rawOnly) { Console.WriteLine(ToHex(hasher.HashRaw(pwd, salt))); return; } if (encodedOnly) { Console.WriteLine(hasher.Hash(pwd, salt)); return; } var startTime = DateTime.Now; string encoded = hasher.Hash(pwd, salt); var stopTime = DateTime.Now; HashMetadata metadata = PasswordHasher.ExtractMetadata(encoded); Console.WriteLine("Hash:\t\t" + ToHex(metadata.Hash)); Console.WriteLine("Encoded:\t" + encoded); Console.WriteLine("{0:0.000} seconds", (stopTime - startTime).TotalSeconds); if(hasher.Verify(encoded, pwd)) Console.WriteLine("Verification ok"); else throw new Argon2Exception("verifying", Argon2Error.VERIFY_MISMATCH); } catch (Exception ex) { Fatal(ex.Message); } }