CryptoSys API Library Manual

SHA1_StringHexHash

Creates a SHA-1 message digest in hexadecimal format from a message of String type.

VBA/VB6 Syntax

Public Declare Function SHA1_StringHexHash Lib "diCryptoSys.dll" (ByVal strDigest As String, ByVal strMessage As String) As Long

nRet = SHA1_StringHexHash(strDigest, strMessage)

C/C++ Syntax

long __stdcall SHA1_StringHexHash(char *szDigest, const char *szMessage);

Parameters

szDigest
[out] to receive message digest.
szMessage
[in] containing the message to be hashed.

Returns (VBA/C)

If successful, the return value is 0; otherwise it returns a non-zero error code.

.NET Equivalent

Sha1.HexHash Method (String)

COM/ASP Equivalent

sha1.StringHexHash
Public Function StringHexHash(ByVal strData As String) As String

See sha1.StringHexHash.

Remarks

szDigest must be at least 40 (API_MAX_SHA1_CHARS) characters long (41 in a C program).

Example

    Dim nRet As Long
    Dim strDigest As String
    ' Set strDigest to be 40 chars
    strDigest = String(40, " ")
    nRet = SHA1_StringHexHash(strDigest, "abc")
    Debug.Print strDigest

    nRet = SHA1_StringHexHash(strDigest, _
        "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
    Debug.Print strDigest

This should result in output as follows:

a9993e364706816aba3e25717850c26c9cd0d89d
84983e441c3bd26ebaae4aa1f95129e5e54670f1

See Also

SHA1_FileHexHash SHA1_BytesHexHash SHA1_BytesHash

[Contents] [Index]

[PREV: SHA1_Reset...]   [Contents]   [Index]   
   [NEXT: SHA2_AddBytes...]

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