Ejemplo n.º 1
0
        public static byte[] DeriveKey(byte[] password, byte[] salt, PasswordHash.Strength strength = Sodium.PasswordHash.Strength.Interactive)
        {
            //hash the salt to ensure that it's the expected size of 32 bytes
            var hashedSalt = FastHash(salt);

            return Sodium.PasswordHash.ScryptHashBinary(password, hashedSalt, strength);
        }
Ejemplo n.º 2
0
 public static byte[] DeriveKey(byte[] password, byte[] salt, PasswordHash.Strength strength = PasswordHash.Strength.Interactive)
 {
     return Hashing.DeriveKey(password, salt, strength);
 }
Ejemplo n.º 3
0
 public static byte[] DeriveKey(string password, byte[] salt, PasswordHash.Strength strength = PasswordHash.Strength.Interactive)
 {
     return DeriveKey(Encoding.UTF8.GetBytes(password), salt, strength);
 }
Ejemplo n.º 4
0
 public static string PasswordHash(string password, PasswordHash.Strength strength = Sodium.PasswordHash.Strength.Interactive)
 {
     return Sodium.PasswordHash.ScryptHashString(password, strength);
 }