[VB6 equivalent: PBE_Kdf2Hex]
Dim strDerivedKey As String Dim nKeyLen As Integer Dim strPassword As String Dim strSaltHex As String Dim nCount As Integer strPassword = "password" ' NB normal text, not hex ' Set 8-byte salt = 78 57 8E 5A 5D 63 CB 06 strSaltHex = "78578E5A5D63CB06" ' Iteration count is 2048 nCount = 2048 nKeyLen = 24 ' Derive PBKDF2 key using function from CryptoSys API strDerivedKey = Pbe.Kdf2(nKeyLen, strPassword, strSaltHex, nCount) ' Check against test vector Console.WriteLine("Derived key = " & strDerivedKey) Console.WriteLine("Correct key = BFDE6BE94DF7E11DD409BCE20A0255EC327CB936FFE93643")
See Also:
Pbe.Kdf2 Method (Int32, String, String, Int32, HashAlgorithm)