Class Argon2Config
Holds configuration needed to perform an Argon2 hash.
Inheritance
Inherited Members
Namespace: Isopoh.Cryptography.Argon2
Assembly: Isopoh.Cryptography.Argon2.dll
Syntax
public sealed class Argon2Config
Properties
| Improve this Doc View SourceAssociatedData
Gets or sets the associated data used in the password hash.
Declaration
public byte[] AssociatedData { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] |
ClearPassword
Gets or sets a value indicating whether to clear the password as soon as it is no longer needed.
Declaration
public bool ClearPassword { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
If true and the configuration has a password, the configuration cannot be used more than once without resetting the password (unless you want an all zero password).
ClearSecret
Gets or sets a value indicating whether to clear the secret as soon as it is no longer needed.
Declaration
public bool ClearSecret { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
If true and the configuration has a secret, the configuration cannot be used more than once without resetting the secret (unless you want an all zero secret).
HashLength
Gets or sets the hash length to output. Minimum of 4. Default 32.
Declaration
public int HashLength { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Lanes
Gets or sets the lanes used in the password hash. Minimum of 1. Defaults to 4.
Declaration
public int Lanes { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
This describes the maximum parallelism that can be achieved. Each "lane" can be processed individually in its own thread. Setting Threads to a value greater than one when there is more than one lane will allow the use of multiple cores to speed up hashing.
MemoryCost
Gets or sets the memory cost used in the password hash. Minimum of 1. Defaults to 65536.
Declaration
public int MemoryCost { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
This translates into a target count of memory blocks to use for hashing. A memory block is 1024 bytes so the default 65536 is for a 64MB hash.
If this value is less than 2*SyncPointCount*Lanes, than 2*SyncPointCount*Lanes will be used.
If this value is not a multiple of SyncPointCount*Lanes, than it is rounded down to a multiple of SyncPointCount*Lanes.
Password
Gets or sets the password to hash.
Declaration
public byte[] Password { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] |
Salt
Gets or sets the salt used in the password hash. If non-null, must be at least 8 bytes.
Declaration
public byte[] Salt { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] |
Secret
Gets or sets the secret used in the password hash.
Declaration
public byte[] Secret { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] |
SecureArrayCall
Gets or sets the methods that get called to secure arrays. Defaults to SecureArray.DefaultCall.
Declaration
public SecureArrayCall SecureArrayCall { get; set; }
Property Value
Type | Description |
---|---|
SecureArrayCall |
Threads
Gets or sets the threads used in the password hash. Minimum of 1. Defaults to 1.
Declaration
public int Threads { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
This value makes no difference in the result. A value greater than one causes that many threads to get spawned to do the work on top of the main thread that orchestrates which thread does what work.
Lanes defines the maximum parallelism that can be achieved. Setting Threads to a value greater than Lanes will not result in more than Lanes threads running.
TimeCost
Gets or sets the time cost used in the password hash. Minimum of 1. Defaults to 3.
Declaration
public int TimeCost { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
This is the number of iterations to perform. There are attacks on the Argon2Version.Sixteen with less than three iterations (if I'm reading the paper correctly). So, use a value greater then 3 here if you are not using Argon2Version.Nineteen.
Type
Gets or sets the Argon2 type. Default to hybrid.
Declaration
public Argon2Type Type { get; set; }
Property Value
Type | Description |
---|---|
Argon2Type |
Version
Gets or sets the Argon2 version used in the password hash. Defaults to Argon2Version.Nineteen (0x13).
Declaration
public Argon2Version Version { get; set; }
Property Value
Type | Description |
---|---|
Argon2Version |