Click or drag to resize

PbeKdf2(Int32, String, String, Int32, HashAlgorithm) Method

Derives a key in hex format of any length from a password with the salt in hex format using specified HMAC algorithm

Namespace: CryptoSysAPI
Assembly: diCrSysAPINet (in diCrSysAPINet.dll) Version: 6.22.2.24248 (6.22.2.0)
Syntax
public static string Kdf2(
	int dkLen,
	string pwdStr,
	string saltHex,
	int count,
	HashAlgorithm hashAlg = HashAlgorithm.Sha1
)

Parameters

dkLen  Int32
Required length of key in bytes
pwdStr  String
Password
saltHex  String
Salt in hex format
count  Int32
Iteration count
hashAlg  HashAlgorithm  (Optional)
Hash algorithm to use in HMAC PRF (optional, default=SHA-1)

Return Value

String
Key in hex format
Remarks
Password pwdStr is normal text, not hexadecimal
Example
C#
string keyHex = Pbe.Kdf2(24, "password", "78578e5a5d63cb06", 2048);
// BFDE6BE94DF7E11DD409BCE20A0255EC327CB936FFE93643
See Also