CryptoSys PKI Pro Manual

Example: Hmac.HexFromHex 

[VB6 equivalent: HMAC_HexFromHex]

Dim strDigest As String
Dim strData As String
Dim strKey As String
' Ref: RFC 2202 and RFC 4231
' Test Case 1
' Key =  0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
'        0b0b0b0b                    (20 bytes)
' Data = 4869205468657265            ("Hi There")

' Compute HMAC-SHA-1
strData = "4869205468657265"
strKey = "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"
strDigest = Hmac.HexFromHex(strData, strKey, HashAlgorithm.Sha1)
Console.WriteLine(strDigest)
' Compute HMAC-SHA-256
strDigest = Hmac.HexFromHex(strData, strKey, HashAlgorithm.Sha256)
Console.WriteLine(strDigest)

See Also:
Hmac.HexFromHex Method

[Contents] [Index]

[PREV: Example: Hmac.HexFromBytes ...]   [Contents]   [Index]   
   [NEXT: Example: Ocsp.MakeRequest ...]

Copyright © 2004-23 D.I. Management Services Pty Ltd. All rights reserved. Generated 2023-09-18T10:02:53Z.