CryptoSys API Library Manual

hashHexFromBits

Compute hash digest in hex format from bit-oriented input.

Syntax

[VBA]
Public Function hashHexFromBits ( _
    lpData() As Byte, _
    nDataBitLen As Long, _
    nOptions As Long _
) As String

Parameters

lpData
Bit-oriented message data in byte array.
nDataBitLen
length of the message data in bits.
nOptions
Algorithm to be used. Select one from:
API_HASH_SHA1
API_HASH_SHA224
API_HASH_SHA256
API_HASH_SHA384
API_HASH_SHA512
API_HASH_SHA3_224
API_HASH_SHA3_256
API_HASH_SHA3_384
API_HASH_SHA3_512

Return Value

String: Message digest in hex-encoded format.

Remarks

Only the SHA family of hash functions is supported in bit-oriented mode. Pass a bitstring as an array of bytes in lpData in big-endian order with the most-significant bit first. The bitstring will be truncated to the number of bits specified in nDataBitLen and extraneous bits on the right will be ignored.

Example

' NIST SHAVS CAVS 11.0 "SHA-1 ShortMsg" information
lpData = cnvBytesFromHexStr("5180")  ' 9-bit bitstring = 0101 0001 1
strDigest = hashHexFromBits(lpData, 9, API_HASH_SHA1)
Debug.Print "MD = " & strDigest
Debug.Print "OK = 0f582fa68b71ecdf1dcfc4946019cf5a18225bd2"
[PREV: hashFinal...]   [Contents]   [Index]   
   [NEXT: hashHexFromBytes...]

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