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.

VB6/VBA 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)

Parameters

strKey
[in] String containing the key in hexadecimal representation.
bEncrypt
[in] Boolean direction flag: set as True to encrypt or False to decrypt.
strMode
[in] String 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.
strIV
[in] String containing the initialization vector in hexadecimal.

C/C++ Syntax

long _stdcall BLF_InitHex(const char *strHexKey, int bEncrypt, const char *strMode, const char *strHexIV);

Returns (VB6/C)

Long: 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 strIV must be exactly 16 hex characters long (i.e. representing exactly 8 bytes) unless strMode is ECB, in which case strIV is ignored (use ""). The key strKey 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]

[HOME]   [NEXT: BLF_Update...]

Copyright © 2001-11 D.I. Management Services Pty Ltd. All rights reserved.