CryptoSys API Library Manual

MAC_Init

Initialises the MAC context ready for subsequent calls with MAC_AddBytes and MAC_Final.

VBA/VB6 Syntax

Public Declare Function MAC_Init Lib "diCryptoSys.dll" (ByRef lpKey As Byte, ByVal nKeyLen As Long, ByVal nAlg As Long) As Long

hContext = MAC_Init(lpKey, nKeyLen, nAlg)

C/C++ Syntax

long __stdcall MAC_Init(const void *lpKey, long nKeyLen, long nAlg);

Parameters

lpKey
[in] Key in byte format.
nKeyLen
[in] Length of key in bytes.
nAlg
[in] Algorithm to be used. Select one of:
API_HMAC_SHA1 (0) to use the HMAC-SHA-1 algorithm (default)
API_HMAC_SHA224 to use the HMAC-SHA-224 algorithm
API_HMAC_SHA256 to use the HMAC-SHA-256 algorithm
API_HMAC_SHA384 to use the HMAC-SHA-384 algorithm
API_HMAC_SHA512 to use the HMAC-SHA-512 algorithm

Returns (VBA/C)

Non-zero handle of the MAC context, or zero if an error occurs.

VBA Wrapper Syntax

Public Function macInit(lpKey() As Byte, nAlg As Long) As Long

.NET Equivalent

Mac.Init Method

C++ (STL) Equivalent

bool crsysapi::Mac::Init (bvec_t key, Alg alg)

Remarks

Only the HMAC-SHA-1 and HMAC-SHA-2 families of MAC algorithms are currently supported. While the context handle is valid, add data to be digested in blocks of any length using MAC_AddBytes. VBA users can use the wrapper functions macAddBytes and macAddString.

Example

See MAC_AddBytes.

See Also

MAC_AddBytes MAC_Final

[Contents] [Index]

[PREV: MAC_HexFromHex...]   [Contents]   [Index]   
   [NEXT: MAC_Reset...]

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