메소드 | 설명 | |
---|---|---|
ExtractMetadata ( string formattedHash ) : |
Extracts the memory cost, time cost, etc. used to generate the Argon2 hash. An encoded Argon2 hash created by the Hash method
|
|
GenerateSalt ( uint byteLength = 16 ) : byte[] |
Generate salt using a Cryptographically-Secure Pseudo-Random Number Generator The number of bytes of salt to generate (default: 16)
|
|
Hash ( byte password ) : string |
Hash the raw password bytes using Argon2 with a cryptographically-secure, random, 16-byte salt. Do not compare two Argon2 hashes directly. Instead, use the Verify or VerifyAndUpdate methods. The raw bytes of the password to be hashed
|
|
Hash ( byte password, byte salt ) : string |
Hash the raw password bytes using Argon2 with the specified salt bytes. Unless you need to specify your own salt for interoperability purposes, prefer the Hash(byte[] password) overload instead. Do not compare two Argon2 hashes directly. Instead, use the Verify or VerifyAndUpdate methods. The raw bytes of the password to be hashed The raw salt bytes to be used for the hash. The salt must be at least 8 bytes.
|
|
Hash ( string password ) : string |
Hash the password using Argon2 with a cryptographically-secure, random, 16-byte salt. This is the only overload of the Hash method that the typical user will need to use for password storage. The other overloads are provided for interoperability purposes. Do not compare two Argon2 hashes directly. Instead, use the Verify or VerifyAndUpdate methods. A string representing the password to be hashed. The password is first decoded into bytes using StringEncoding (default: Encoding.UTF8)
|
|
Hash ( string password, string salt ) : string |
Hash the password using Argon2 with the specified salt. Unless you need to specify your own salt for interoperability purposes, prefer the Hash(string password) overload instead. Do not compare two Argon2 hashes directly. Instead, use the Verify or VerifyAndUpdate methods. A string representing the password to be hashed. The password is first decoded into bytes using StringEncoding (default: Encoding.UTF8) A string representing the salt to be used for the hash. The salt must be at least 8 bytes. The salt is first decoded into bytes using StringEncoding (default: Encoding.UTF8)
|
|
HashRaw ( byte password, byte salt ) : byte[] |
Hash the password using Argon2 with the specified salt. The HashRaw methods may be used for password-based key derivation. Unless you're using HashRaw for key deriviation or for interoperability purposes, the Hash methods should be used in favor of the HashRaw methods. The raw bytes of the password to be hashed The raw salt bytes to be used for the hash. The salt must be at least 8 bytes.
|
|
HashRaw ( string password, string salt ) : byte[] |
Hash the password using Argon2 with the specified salt. The HashRaw methods may be used for password-based key derivation. Unless you're using HashRaw for key deriviation or for interoperability purposes, the Hash methods should be used in favor of the HashRaw methods. A string representing the password to be hashed. The password is first decoded into bytes using StringEncoding (default: Encoding.UTF8) A string representing the salt to be used for the hash. The salt must be at least 8 bytes. The salt is first decoded into bytes using StringEncoding (default: Encoding.UTF8)
|
|
PasswordHasher ( UsageEnvironment environment ) : System |
Initialize the Argon2 PasswordHasher with default performance and algorithm settings based upon the environment the hashing will be used in. You should perform your own profiling to determine what the parameters should be for your specific usage; however, this attempts to provide some reasonable defaults. Whether the PasswordHasher will be used in a server or single-user setting
|
|
PasswordHasher ( uint timeCost = 3, uint memoryCost = 8192, uint parallelism = 1, Argon2Type argonType = Argon2Type.Argon2i, uint hashLength = 32 ) : System |
Initialize the Argon2 PasswordHasher with the performance and algorithm settings to use while hashing How many iterations of the Argon2 hash to perform (default: 3, must be at least 1) How much memory to use while hashing in kibibytes (KiB) (default: 8192 KiB [8 MiB], must be at least 8 KiB) How many threads to use while hashing (default: 1, must be at least 1) The type of Argon2 hashing algorithm to use (Independent [default] or Dependent) The length of the resulting hash in bytes (default: 32)
|
|
Verify ( string expectedHash, byte password ) : bool |
Hashes the raw password bytes and verifies that the password results in the specified hash. The ArgonType must of this PasswordHasher object must match what was used to generate expectedHash. The other parameters (timeCost, etc.) do not need to match and the parameters embedded in the expectedHash will be used. Hashing the password should result in this hash The raw password bytes to hash and compare its result to expectedHash
|
|
Verify ( string expectedHash, string password ) : bool |
Hashes the password and verifies that the password results in the specified hash. The ArgonType must of this PasswordHasher object must match what was used to generate expectedHash. The other parameters (timeCost, etc.) do not need to match and the parameters embedded in the expectedHash will be used. Hashing the password should result in this hash The password to hash and compare its result to expectedHash. The password is first decoded into bytes using StringEncoding (default: Encoding.UTF8)
|
|
VerifyAndUpdate ( string expectedHash, byte password, bool &isUpdated, string &newFormattedHash ) : bool |
Hashes the password and verifies that the password results in the specified hash. (See Verify method) If the password verification is successful, this method checks to see if the memory cost, time cost, and parallelism match the parameters the PasswordHasher object was constructed with. If they do not much, then the password is rehashed using the new parameters and the result is outputted via the newFormattedHash parameter. Hashing the password should result in this hash The raw password bytes to hash and compare its result to expectedHash Whether the cost parameters of expectedHash differ from the PasswordHasher object and if the password was rehashed using th new parameters. This is always false if the password was incorrect. If isUpdated is true, then newFormattedHash is the password hashed with the new cost parameters. If isUpdated is false, then newFormattedHash is expectedHash.
|
|
VerifyAndUpdate ( string expectedHash, string password, bool &isUpdated, string &newFormattedHash ) : bool |
Hashes the password and verifies that the password results in the specified hash. (See Verify method) If the password verification is successful, this method checks to see if the memory cost, time cost, and parallelism match the parameters the PasswordHasher object was constructed with. If they do not much, then the password is rehashed using the new parameters and the result is outputted via the newFormattedHash parameter. Hashing the password should result in this hash The password to hash and compare its result to expectedHash. The password is first decoded into bytes using StringEncoding (default: Encoding.UTF8) Whether the cost parameters of expectedHash differ from the PasswordHasher object and if the password was rehashed using th new parameters. This is always false if the password was incorrect. If isUpdated is true, then newFormattedHash is the password hashed with the new cost parameters. If isUpdated is false, then newFormattedHash is expectedHash.
|
메소드 | 설명 | |
---|---|---|
CheckNull ( string methodName ) : void | ||
crypto_argon2_hash ( uint t_cost, uint m_cost, uint parallelism, byte pwd, int pwdlen, byte salt, int saltlen, byte hash, int hashlen, byte encoded, int encodedlen, int type, int version ) : int | ||
crypto_argon2_verify ( byte encoded, byte pwd, int pwdlen, int type ) : int | ||
crypto_decode_string ( Argon2Context ctx, byte str, int type ) : int |
public static ExtractMetadata ( string formattedHash ) : |
||
formattedHash | string | |
리턴 |
public static GenerateSalt ( uint byteLength = 16 ) : byte[] | ||
byteLength | uint | |
리턴 | byte[] |
public Hash ( string password, string salt ) : string | ||
password | string | |
salt | string | |
리턴 | string |
public HashRaw ( byte password, byte salt ) : byte[] | ||
password | byte | |
salt | byte | |
리턴 | byte[] |
public HashRaw ( string password, string salt ) : byte[] | ||
password | string | |
salt | string | |
리턴 | byte[] |
public PasswordHasher ( UsageEnvironment environment ) : System | ||
environment | UsageEnvironment | |
리턴 | System |
public PasswordHasher ( uint timeCost = 3, uint memoryCost = 8192, uint parallelism = 1, Argon2Type argonType = Argon2Type.Argon2i, uint hashLength = 32 ) : System | ||
timeCost | uint | |
memoryCost | uint | |
parallelism | uint | |
argonType | Argon2Type | |
hashLength | uint | |
리턴 | System |
public Verify ( string expectedHash, byte password ) : bool | ||
expectedHash | string | |
password | byte | |
리턴 | bool |
public Verify ( string expectedHash, string password ) : bool | ||
expectedHash | string | |
password | string | |
리턴 | bool |
public VerifyAndUpdate ( string expectedHash, byte password, bool &isUpdated, string &newFormattedHash ) : bool | ||
expectedHash | string | |
password | byte | |
isUpdated | bool | |
newFormattedHash | string | |
리턴 | bool |
public VerifyAndUpdate ( string expectedHash, string password, bool &isUpdated, string &newFormattedHash ) : bool | ||
expectedHash | string | |
password | string | |
isUpdated | bool | |
newFormattedHash | string | |
리턴 | bool |