Ejemplo n.º 1
0
 /// <summary>
 /// Uses the given key, salt, and cost to generate a BCrypt hash.
 /// Flags may modify the key expansion.
 /// </summary>
 /// <param name="key">
 ///     The key. This must be between 1 and 72 bytes.
 ///     Unlike <see cref="BlowfishCrypter"/>, this method does NOT automatically add a null byte to the key.
 /// </param>
 /// <param name="salt">The salt. This must be 16 bytes.</param>
 /// <param name="cost">
 ///     The expansion cost. This is a value between 4 and 31,
 ///     specifying the logarithm of the number of iterations.
 /// </param>
 /// <param name="flags">Flags modifying the key expansion.</param>
 /// <returns>A BCrypt hash.</returns>
 public static byte[] BCrypt(byte[] key, byte[] salt, int cost,
                             EksBlowfishKeyExpansionFlags flags)
 {
     using (BlowfishCipher fish = CreateEks(key, salt, cost, flags))
     {
         return(fish.BCrypt());
     }
 }