Initialises the context with the key, direction and mode ready for repeated operations of the DES function. The key and IV data are provided in hexadecimal format.
Public Declare Function DES_InitHex Lib "diCryptoSys.dll"
(ByVal strHexKey As String, ByVal bEncrypt As Boolean,
ByVal strMode As String, ByVal strHexIV As String) As Long
hContext = DES_InitHex(strHexKey, bEncrypt, strMode, strHexIV)
long __stdcall DES_InitHex(const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
Non-zero handle of the context hContext
to be used in subsequent calls to the functions
DES_Update
, DES_UpdateHex
or DES_Final
.
Returns zero if an error occurs.
Des.InitEncrypt Method (String, Mode, String)
Des.InitDecrypt Method (String, Mode, String)
The key string szHexKey must be exactly 16 hex characters long (i.e. representing exactly 8 bytes/64 bits).
The initialization vector
string szHexIV must be exactly 16 hex characters long
(i.e. representing exactly the block size of 8 bytes), except for ECB mode, where it is ignored (use ""
).
Valid hexadecimal characters are [0-9A-Fa-f].
Unlike most other functions in this API, DES_InitHex
returns zero if an error occurs.
It is important to check that the value of hContext returned is
not equal to zero before calling a DES_Update function.
See DES_UpdateHex
.
DES_Init
DES_UpdateHex
DES_Update
DES_Final