EncodeExtensionEncodeString Method

Encodes an Argon2 instance into a string.

Definition

Namespace: Gemstone.Security.Cryptography.Argon2Hash
Assembly: Gemstone.Security (in Gemstone.Security.dll) Version: 1.0.171 -- Release Build+9bbaecd83e44e0973a7b18ef958272cfb4d67729
public static string EncodeString(
	this Argon2Config config,
	byte[]? hash
)

Parameters

config  Argon2Config
To encode.
hash  Byte
The hash to put in the encoded string. May be null.

Return Value

String
The encoded Argon2 instance.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Argon2Config. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

Resulting format:

$argon2<T>[$v=<num>]$m=<num>,t=<num>,p=<num>[,keyid=<bin>][,data=<bin>][$<bin>[$<bin>]].

where <T> is either 'd' or 'i', <num> is a decimal integer (positive, fits in an 'unsigned long'), and <bin> is Base64-encoded data (no '=' padding characters, no newline or whitespace). The "keyid" is a binary identifier for a key (up to 8 bytes); "data" is associated data (up to 32 bytes). When the 'keyid' (resp. the 'data') is empty, then it is omitted from the output.

The last two binary chunks (encoded in Base64) are, in that order, the salt and the output. Both are optional, but you cannot have an output without a salt. The binary salt length is between 8 and 48 bytes. The output length is always exactly 32 bytes.

See Also