Creates a key from algorithm and password
#include <Crypt.au3>
_Crypt_DeriveKey ( $vPassword, $iALGID [, $iHash_ALG_ID = $CALG_MD5] )
| $vPassword | Password to use |
| $iALGID | Encryption ID of algorithm to be used with the key |
| $iHash_ALG_ID | [optional] Id of the algo to hash the password with |
| Success: | a handle to a cryptographic key. |
| Failure: | -1 and sets the @error flag to non-zero. |
| @error: | 10 - Failed to create hash object 20 - Failed to hash password 30 - Failed to generate key |
#include <Crypt.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
Local $aStringsToEncrypt[6] = ["AutoIt", "SciTE", "Crypt", ".au3", 42, "42"]
Local $sOutput = ""
Local $hKey = _Crypt_DeriveKey("CryptPassword", $CALG_RC4) ; Declare a password string and algorithm to create a cryptographic key.
For $iWord In $aStringsToEncrypt
$sOutput &= $iWord & @TAB & " = " & _Crypt_EncryptData($iWord, $hKey, $CALG_USERKEY) & @CRLF ; Encrypt the text with the cryptographic key.
Next
MsgBox($MB_SYSTEMMODAL, "Encrypted data", $sOutput)
_Crypt_DestroyKey($hKey) ; Destroy the cryptographic key.
EndFunc ;==>Example