Public Function SHA1(ByVal s As String) As String
Dim Enc As Object, Prov As Object
Dim Hash() As Byte, i As Integer
Set Enc = CreateObject("System.Text.UTF8Encoding")
Set Prov = CreateObject("System.Security.Cryptography.SHA1CryptoServiceProvider")
Hash = Prov.ComputeHash_2(Enc.GetBytes_4(s))
SHA1 = ""
For i = LBound(Hash) To UBound(Hash)
SHA1 = SHA1 & Hex(Hash(i) 16) & Hex(Hash(i) Mod 16)
Next
End Function
以上是转发的,没验证过,但应该可行,利用 VBA 中的 .NET 库。 将哈希返回为大写十六进制。
还有就是自己计算出来,没除非有人帮你写好,不然没什么简单的语句能获得