@@ -1202,7 +1202,7 @@ Public Function HMACSHA1(Text As String, Secret As String, Optional Format As St
12021202 Dim web_Bytes() As Byte
12031203
12041204 web_TextBytes = VBA.StrConv(Text, vbFromUnicode)
1205- web_SecretBytes = VBA.StrConv(Text , vbFromUnicode)
1205+ web_SecretBytes = VBA.StrConv(Secret , vbFromUnicode)
12061206
12071207 Set web_Crypto = CreateObject("System.Security.Cryptography.HMACSHA1" )
12081208 web_Crypto.Key = web_SecretBytes
@@ -1242,17 +1242,17 @@ Public Function HMACSHA256(Text As String, Secret As String, Optional Format As
12421242 Dim web_Bytes() As Byte
12431243
12441244 web_TextBytes = VBA.StrConv(Text, vbFromUnicode)
1245- web_SecretBytes = VBA.StrConv(Text , vbFromUnicode)
1245+ web_SecretBytes = VBA.StrConv(Secret , vbFromUnicode)
12461246
12471247 Set web_Crypto = CreateObject("System.Security.Cryptography.HMACSHA256" )
12481248 web_Crypto.Key = web_SecretBytes
12491249 web_Bytes = web_Crypto.ComputeHash_2(web_TextBytes)
12501250
12511251 Select Case Format
12521252 Case "Base64"
1253- HMACSHA1 = web_AnsiBytesToBase64(web_Bytes)
1253+ HMACSHA256 = web_AnsiBytesToBase64(web_Bytes)
12541254 Case Else
1255- HMACSHA1 = web_AnsiBytesToHex(web_Bytes)
1255+ HMACSHA256 = web_AnsiBytesToHex(web_Bytes)
12561256 End Select
12571257#End If
12581258End Function
@@ -1287,9 +1287,9 @@ Public Function MD5(Text As String, Optional Format As String = "Hex") As String
12871287
12881288 Select Case Format
12891289 Case "Base64"
1290- HMACSHA1 = web_AnsiBytesToBase64(web_Bytes)
1290+ MD5 = web_AnsiBytesToBase64(web_Bytes)
12911291 Case Else
1292- HMACSHA1 = web_AnsiBytesToHex(web_Bytes)
1292+ MD5 = web_AnsiBytesToHex(web_Bytes)
12931293 End Select
12941294#End If
12951295End Function
0 commit comments