Crypto plug-in: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(→Links) |
|||
Line 32: | Line 32: | ||
Supported algorithms: MD5|SHA1|MD2|MD4 | Supported algorithms: MD5|SHA1|MD2|MD4 | ||
Calculate the hash of the file you want checked using the Hash Calculator ([http://forums.winamp.com/attachment.php?s=&postid=1346396 hashcalc.zip]). | |||
From there I was able to use Crypto to ensure that notepad hasn't changed: | |||
<highlight-nsis> | <highlight-nsis> | ||
Crypto::HashFile "MD5" "$WINDIR\notepad.exe" | Crypto::HashFile "MD5" "$WINDIR\notepad.exe" | ||
Pop $0 | Pop $0 | ||
StrCmp $0 " | StrCmp $0 "FF7F14FDA901090E337488A1900E3660" +3 | ||
MessageBox MB_OK|MB_TOPMOST|MB_SETFOREGROUND|MB_ICONSTOP "ERROR: notepad.exe has been changed!!!" | MessageBox MB_OK|MB_TOPMOST|MB_SETFOREGROUND|MB_ICONSTOP "ERROR: notepad.exe has been changed!!!" | ||
Quit | Quit | ||
</highlight-nsis> | </highlight-nsis> | ||
[[Category:Plugins]] | [[Category:Plugins]] |
Revision as of 23:26, 12 August 2007
Author: GAG (talk, contrib) |
Links
cryptoplg11.zip (43 KB) (plugin dll + readme + examples)
hashcalc.zip (30 KB) (Calculates the hash for Strings or specified files)
Introduction
Version: 1.1.
This plugin provides you cryptographic interface using CryptoAPI. Using this plugin you can get common cryptographic hashes like MD5, SHA1, MD2, MD4.
Plugin DLL size: 3 660 bytes (not packed), 2 886 bytes (upx packed)
How to use
String Hash
Crypto::HashData "MD5" "String to be hashed" Pop $0
Supported algorithms: MD5|SHA1|MD2|MD4
File Hash
Crypto::HashFile "MD5" "$WINDIR\notepad.exe" Pop $0
Supported algorithms: MD5|SHA1|MD2|MD4
Calculate the hash of the file you want checked using the Hash Calculator (hashcalc.zip). From there I was able to use Crypto to ensure that notepad hasn't changed:
Crypto::HashFile "MD5" "$WINDIR\notepad.exe" Pop $0 StrCmp $0 "FF7F14FDA901090E337488A1900E3660" +3 MessageBox MB_OK|MB_TOPMOST|MB_SETFOREGROUND|MB_ICONSTOP "ERROR: notepad.exe has been changed!!!" Quit