Argon2Hash(Byte, Byte, 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.170 -- Release Build+ca3065dc8f8b84c59ee38bd3367c3e71f3818071
public static string Hash(
	byte[] password,
	byte[]? secret,
	int timeCost = 3,
	int memoryCost = 65536,
	int parallelism = 1,
	Argon2Type type = Argon2Type.HybridAddressing,
	int hashLength = 32
)

Parameters

password  Byte
The password to hash. Gets UTF-8 encoded before hashing.
secret  Byte
The secret to use in creating the hash.
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