Argon2Hash(String, String, Int32, Int32, Int32, Argon2Type, Int32) Method

Hash the given password to an Argon2 hash string.

Definition

Namespace: Gemstone.Security.Cryptography.Argon2Hash
Assembly: Gemstone.Security (in Gemstone.Security.dll) Version: 1.0.166 -- Release Build+3ac73912f52c3309a818fcc8cd731758651aaeae
public static string Hash(
	string password,
	string? secret,
	int timeCost = 3,
	int memoryCost = 65536,
	int parallelism = 1,
	Argon2Type type = Argon2Type.HybridAddressing,
	int hashLength = 32
)

Parameters

password  String
The password to hash. Gets UTF-8 encoded before hashing.
secret  String
The secret to use in creating the hash. UTF-8 encoded before hashing. May be null. A string.Empty is treated the same as null.
timeCost  Int32  (Optional)
The time cost to use. Defaults to 3.
memoryCost  Int32  (Optional)
The target memory cost to use. Defaults to 65536 (65536 * 1024 = 64MB). MemoryCost for detail on calculating the actual memory used from this value.
parallelism  Int32  (Optional)
The parallelism to use. Default to 1 (single threaded).
type  Argon2Type  (Optional)
Data-dependent, data-independent, or hybrid. Defaults to hybrid (as recommended for password hashing).
hashLength  Int32  (Optional)
The length of the hash in bytes. Note, the string returned base-64 encodes this with other parameters so the resulting string is significantly longer.

Return Value

String
The Argon2 hash of the given password.

See Also