Exemplo n.º 1
0
 /// <summary>
 /// Derives the specified password by applying the given <paramref name="options"/> to
 /// the underlying implementations.
 /// </summary>
 /// <param name="password">The password.</param>
 /// <param name="options">The options.</param>
 /// <returns></returns>
 public static string Derive(string password, PasswordHasherOptions options)
 {
     PasswordHasherBase kdb = PasswordHasherFactory.GetInstance(options.Algorithm);
     return kdb.Compute(password, options);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Derives a key from the given password, using sane defaults.
 /// </summary>
 /// <remarks>
 /// This method is using the PBKDF2 algorithm underneath, with random salts
 /// of size 16 bytes, and an interation count in the interval [8000;9000].
 /// 
 /// The SHA2 hash is used for the HMAC algorithm
 /// </remarks>
 /// <param name="password">The master password to derive a key from</param>
 /// <returns></returns>
 public static string Derive(string password)
 {
     // default settings are good..
     PasswordHasherOptions options = new PasswordHasherOptions();
     return Derive(password, options);
 }