Crypto plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
Line 2: Line 2:


== Links ==
== Links ==
[[File:Zip.gif]] [http://forums.winamp.com/attachment.php?postid=1346355 cryptoplg11.zip] (43 KB) (plugin dll + readme + examples)
[[File:Zip.gif]] [http://forums.winamp.com/attachment.php?postid=1346355 cryptoplg11.zip] (43 KB) (plugin dll + readme + examples)<BR>
[[File:Zip.gif]] [http://forums.winamp.com/attachment.php?s=&postid=1346396 hashcalc.zip] (30 KB) (Calculates the hash for Strings or specified files)


[http://forums.winamp.com/showthread.php?postid=1346355 Forum Thread]
[http://forums.winamp.com/showthread.php?postid=1346355 Forum Thread]

Revision as of 23:21, 12 August 2007

Author: GAG (talk, contrib)


Links

Zip.gif cryptoplg11.zip (43 KB) (plugin dll + readme + examples)
Zip.gif hashcalc.zip (30 KB) (Calculates the hash for Strings or specified files)

Forum Thread

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

If you would like to create a hash of your files to be compared to then use md5deep to create your hash and then compare your hash (generated by Crypto plugin) to the hash you generated using md5deep. For example I generated notepad md5 checksum by doing the following in the Windows Command Line:

md5deep.exe "C:\Windows\notepad.exe" > hash.txt

Then I opened hash.txt and it looked like

ff7f14fda901090e337488a1900e3660  C:\Windows\notepad.exe

So 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" Continue
MessageBox MB_OK|MB_TOPMOST|MB_SETFOREGROUND|MB_ICONSTOP "ERROR: notepad.exe has been changed!!!"
Quit
Continue: