Class EncodeExtension
Extension to encode an Argon2 hash string.
Inheritance
Inherited Members
Namespace: Isopoh.Cryptography.Argon2
Assembly: Isopoh.Cryptography.Argon2.dll
Syntax
public static class EncodeExtension
Methods
| Improve this Doc View SourceEncodeString(Argon2Config, Byte[])
Encodes an Argon2 instance into a string.
Declaration
public static string EncodeString(this Argon2Config config, byte[] hash)
Parameters
Type | Name | Description |
---|---|---|
Argon2Config | config | To encode. |
System. |
hash | The hash to put in the encoded string. May be null. |
Returns
Type | Description |
---|---|
System. |
The encoded Argon2 instance. |
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.
ToB64String(Byte[])
Make an Argon2 B64 string which is an RFC 4648 Base64 string without the trailing '=' padding.
Declaration
public static string ToB64String(this byte[] buf)
Parameters
Type | Name | Description |
---|---|---|
System. |
buf | The buffer to convert to a string. |
Returns
Type | Description |
---|---|
System. |
The Argon2 B64 string. |