Adds Argon2 for password protection (#123)

This commit is contained in:
Kamron Batman 2020-05-01 22:42:39 -07:00 • committed by GitHub
parent 29467a3ed9
commit dad8a64fad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 1152 additions and 167 deletions

View file

@ -0,0 +1,20 @@
using System;
namespace Server.Accounting.Security
{
/// <summary>
/// An exception class to wrap the errors returned by Daniel Dinu and Dmitry Khovratovich's Argon2 library.
///
/// Except through very unusual conditions, the only exceptions which could be thrown from PasswordHasher
/// are Argon2Exception, ArgumentNullException, DllNotFoundException (if libargon2.dll is not found)
/// </summary>
public class Argon2Exception : Exception
{
/// <summary>
/// Construct an Argon2Exception with the specified Argon2 error code
/// <param name="action">Which method the Argon2Exception originated from</param>
/// <param name="error">The error returned from the Argon2 library</param>
/// </summary>
public Argon2Exception(string action, Argon2Error error) : base(string.Format("Error during Argon2 {0}: ({1}) {2}", action, (int)error, error)) {}
}
}