嗨,我正在尝试用Python for NSIS安装程序复制这段代码。
M= hashlib.md5("C:\PROGRAM FILES\My Program".encode('utf-16LE'))
它主要是对字符串进行编码,然后对其应用MD5散列。我找到了用于NSIS的MD5散列插件。但是,我仍然不知道如何将$0中的字符串转换为utf-16LE格式。
谢谢
发布于 2019-05-08 00:13:32
如果您正在构建Unicode安装程序,则可以使用Crypto plug-in并直接将字符串提供给它:
Unicode True
...
Section
Crypto::HashUTF16LE MD5 "The quick brown fox jumps over the lazy dog"
Pop $0
DetailPrint $0 ; B0986AE6EE1EEFEE8A4A399090126837
SectionEndANSI安装程序必须将内容写入文件并对文件进行哈希处理:
Section
InitPluginsDir
StrCpy $1 "The quick brown fox jumps over the lazy dog"
StrLen $3 $1
IntOp $3 $3 * 2 ; UTF-16 is 2 bytes per code-unit
FileOpen $2 "$PluginsDir\Temp.txt" w
System::Call 'KERNEL32::WriteFile(pr2,wr1,ir3,*i,p0)' ; This converts the string for us
FileClose $2
Crypto::HashFile MD5 "$PluginsDir\Temp.txt"
Pop $0
DetailPrint $0
SectionEndhttps://stackoverflow.com/questions/55994119
复制相似问题