标签:open cert cmd cer 输出 copy adt win util
操作思路:VBA代码:
strBody = "VBA变量字符串转换为UFT-8后MD5加密"
‘MD5计算
Dim stream As New ADODB.stream
stream.Open
stream.Type = adTypeText
stream.Charset = "utf-8"
stream.WriteText strBody
‘ Try to Remove UTF-8 BOM
stream.Position = 3 ‘skip BOM
Dim BinaryStream As New ADODB.stream
BinaryStream.Type = adTypeBinary
BinaryStream.Mode = adModeReadWrite
BinaryStream.Open
‘ Strips BOM (first 3 bytes)
stream.CopyTo BinaryStream
stream.Flush
stream.Close
str8 = BinaryStream.Read
BinaryStream.SaveToFile "C:\11\AA", adSaveCreateOverWrite
BinaryStream.Flush
BinaryStream.Close
Dim WSH, wExec, sCmd As String
Set WSH = CreateObject("WScript.Shell")
Set wExec = WSH.Exec("CertUtil -hashfile c:\11\AA md5")
Ar = Split(wExec.StdOut.ReadAll, vbCrLf)
N = UBound(Ar)
Sign = Replace(Ar(1), Space(1), "")
Set wExec = Nothing
Set WSH = Nothing
Range("A12") = strBody
EXCEL VBA计算带汉字的字符串的MD5值(VBA转UTF-8保存)
标签:open cert cmd cer 输出 copy adt win util
原文地址:https://blog.51cto.com/mflag/2473469