public static bool Verify(string password, byte[] salt, int iteration, byte[] key) { BytesEx passwordBytes = BytesEx.FromString(password); BytesEx saltBytes = BytesEx.FromBytes(salt); BytesEx keyBytes = BytesEx.FromBytes(key); Pbkdf2Result pbkdf2 = new Pbkdf2Result(passwordBytes, saltBytes, iteration, keyBytes); return(Verify(pbkdf2)); }
public static Pbkdf2Result Hash(string password, int?saltLength, int?iteration, int?keyLength) { Pbkdf2Parameter parameter = new Pbkdf2Parameter(); parameter.Password = BytesEx.FromString(password); parameter.SaltLength = saltLength; parameter.Iteration = iteration; parameter.KeyLength = keyLength; Pbkdf2Result pbkdf2 = Hash(parameter); return(pbkdf2); }