public static byte[] ScryptHashBinary(byte[] password, byte[] salt, PasswordHash.Strength limit = PasswordHash.Strength.Interactive, long outputLength = 32L) { long opsLimit; int memLimit; switch (limit) { case PasswordHash.Strength.Interactive: opsLimit = 524288L; memLimit = 16777216; break; case PasswordHash.Strength.Moderate: opsLimit = 8388608L; memLimit = 100000000; break; case PasswordHash.Strength.Medium: opsLimit = 8388608L; memLimit = 134217728; break; case PasswordHash.Strength.MediumSlow: opsLimit = 33554432L; memLimit = 134217728; break; case PasswordHash.Strength.Sensitive: opsLimit = 33554432L; memLimit = 1073741824; break; default: opsLimit = 524288L; memLimit = 16777216; break; } return(PasswordHash.ScryptHashBinary(password, salt, opsLimit, memLimit, outputLength)); }
public static string ScryptHashString(string password, PasswordHash.Strength limit = PasswordHash.Strength.Interactive) { long opsLimit; int memLimit; switch (limit) { case PasswordHash.Strength.Interactive: opsLimit = 524288L; memLimit = 16777216; break; case PasswordHash.Strength.Moderate: opsLimit = 8388608L; memLimit = 100000000; break; case PasswordHash.Strength.Medium: opsLimit = 8388608L; memLimit = 134217728; break; case PasswordHash.Strength.MediumSlow: opsLimit = 33554432L; memLimit = 134217728; break; case PasswordHash.Strength.Sensitive: opsLimit = 33554432L; memLimit = 1073741824; break; default: opsLimit = 524288L; memLimit = 16777216; break; } return(PasswordHash.ScryptHashString(password, opsLimit, memLimit)); }
public static byte[] ScryptHashBinary(string password, string salt, PasswordHash.Strength limit = PasswordHash.Strength.Interactive, long outputLength = 32L) { return(PasswordHash.ScryptHashBinary(Encoding.UTF8.GetBytes(password), Encoding.UTF8.GetBytes(salt), limit, outputLength)); }