CryptoSys API Library Manual

SHA1_StringHexHash

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

VB6/VBA Syntax

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

nRet = SHA1_StringHexHash(strDigest, strMessage)

Parameters

strDigest
[out] String to receive message digest.
strMessage
[in] String containing the message to be hashed.

C/C++ Syntax

long _stdcall SHA1_StringHexHash(char *strDigest, const char *strMessage);

Returns (VB6/C)

Long: 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

strDigest 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]

[HOME]   [NEXT: SHA2_AddBytes...]

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