CryptoSys API Library Manual

BLF_InitHex

Initialises the context with the key, direction and mode ready for repeated operations of the BLF_Update or BLF_UpdateHex functions. The key and IV data are in hexadecimal format.

VBA/VB6 Syntax

Public Declare Function BLF_InitHex Lib "diCryptoSys.dll" (ByVal strKey As String, ByVal bEncrypt As Boolean, ByVal strMode As String, ByVal strIV As String) As Long

hContext = BLF_InitHex(strKey, bEncrypt, strMode, strIV)

C/C++ Syntax

long __stdcall BLF_InitHex(const char *szKey, int fEncrypt, const char *szMode, const char *sHexIV);

Parameters

szKey
[in] containing the key in hexadecimal representation.
fEncrypt
[in] direction flag: set as ENCRYPT (True) to encrypt or DECRYPT (False) to decrypt.
szMode
[in] specifying the confidentiality mode:
"ECB" for Electronic Codebook mode,
"CBC" for Cipher Block Chaining mode,
"CFB" for 64-bit Cipher Feedback mode,
"OFB" for Output Feedback mode, or
"CTR" for Counter mode.
sHexIV
[in] containing the initialization vector in hexadecimal.

Returns (VBA/C)

Non-zero handle of the context hContext to be used in subsequent calls to the functions BLF_Update, BLF_UpdateHex or BLF_Final. Returns zero if an error occurs.

.NET Equivalent

Blowfish.InitEncrypt Method (String, Mode, String)
Blowfish.InitDecrypt Method (String, Mode, String)

Remarks

The initialization vector string szIV must be exactly 16 hex characters long (i.e. representing exactly 8 bytes) unless szMode is ECB, in which case szIV is ignored (use ""). The key szKey can be any even length between 2 and 112 hexadecimal characters. Valid hexadecimal characters are [0-9A-Fa-f]. Unlike most other functions in this API, BLF_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 BLF_Update or BLF_UpdateHex.

Example

See BLF_UpdateHex.

See Also

BLF_Init BLF_UpdateHex BLF_Update BLF_Final

[Contents] [Index]

[PREV: BLF_InitError...]   [Contents]   [Index]   
   [NEXT: BLF_Update...]

Copyright © 2001-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-01-07T07:42:00Z.