using System.Threading.Tasks; namespace System.Security.Hashing; public interface IPasswordHashingService { /// /// Hash provided raw password and return the hashed value. /// /// Base64 encoded password. /// Base64 encoded salt to be used for hashing. /// Length of the resulting hash. /// Number of hashing iterations to be performed. /// /// The length of the hash will vary due to the base64 encoding of the resulting hash. /// /// Base64 encoded hashed password. Task Hash(string raw, string salt, int length, int iterations); /// /// Hash provided raw password and return the hashed value. /// /// Password to be hashed. /// Salt to be used for hashing. /// Length of the resulting hash. /// Number of hashing iterations to be performed. /// Hashed password. Task Hash(byte[] raw, byte[] salt, int length, int iterations); /// /// Verify provided password against a hashed password. /// /// Base64 encoding of the previously hashed password. /// Base64 encoding of the password to be verified. /// Salt used to hash the previous password. /// Number of iterations used to hash the previous password. /// Returns true if password matches the previously hashed password. Otherwise returns false. Task VerifyPassword(string hash, string password, string salt, int iterations); /// /// Verify provided password against a hashed password. /// /// Previously hashed password. /// Password to be verified. /// Salt used to hash the previous password. /// Number of iterations used to hash the previous password. /// Returns true if password matches the previously hashed password. Otherwise returns false. Task VerifyPassword(byte[] hash, byte[] password, byte[] salt, int iterations); }