Old 13th December 2002, 23:22   #1
IGx89
Junior Member
 
Join Date: Jan 2002
Posts: 21
Send a message via ICQ to IGx89
MD5 plugin

I needed a MD5 plugin for an auto-updater (see it in action here) I've made with NSIS, and since I didn't find any, I made my own . I haven't renamed a bunch of stuff from the original exdll, so just ignore that. I used MSVC++ .NET to make it, so if you have VC++ 6, you might have to convert it using the converter over at www.CodeProject.com, or start the project from scratch.

The final size of the dll is 40.5kb using VC++ .NET Standard, and 22.5kb after packing it with UPX. I've tried to make it smaller, with no avail. If anyone can cut in half (or more ) its size, you have my undying gratitude

Enjoy!
Attached Files
File Type: zip md5plugin.zip (28.4 KB, 1030 views)
IGx89 is offline   Reply With Quote
Old 14th December 2002, 13:19   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
I don't know how this is done with VC7, but you shouldn't link to the default libraries (libc). If you do this you won't be able to use any libc functions including memset (use mini_memset from NSIS sources), sprintf (use wsprintf), strncat (use lstrcat instead [no n, but this can be done manually]), strcpy (use lstrcpy), new and delete (you will have to define your own [IO does that]), strlen (use lstrlen instead), fopen and friends (use CreateFile, CloseFile, ReadFile and WriteFile instead), and memcpy (use mini_memcpy or my_memcpy from one of NSIS contribs). There are more functions you can't use, but those are the ones I have found in your source code. After you dump libc your DLL will be cut at least in half.

You should also rename DllMain back to _DllMainCRTStartup and set the entry point to _DllMainCRTStartup.

Nice idea BTW, submit it to Sunjammer's NSIS Archive when it's ready (and the new archive is ready too).

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 14th December 2002, 14:13   #3
IGx89
Junior Member
 
Join Date: Jan 2002
Posts: 21
Send a message via ICQ to IGx89
Thanks for the tips! I actually did specify no default, and then manually added in libc.lib. That brought it down from 50kb to 40kb. I'll try what you said, and see if I can get it to work

BTW, why did you suggest for me to rename the entry point? What does that do?
IGx89 is offline   Reply With Quote
Old 14th December 2002, 14:25   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
It makes it smaller too.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 14th December 2002, 15:13   #5
IGx89
Junior Member
 
Join Date: Jan 2002
Posts: 21
Send a message via ICQ to IGx89
Goody
IGx89 is offline   Reply With Quote
Old 15th December 2002, 17:35   #6
IGx89
Junior Member
 
Join Date: Jan 2002
Posts: 21
Send a message via ICQ to IGx89
It won't let me use new or delete, either; I think I'll let someone else do the conversion. I'm not THAT desperate
IGx89 is offline   Reply With Quote
Old 15th December 2002, 17:43   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Quote:
new and delete (you will have to define your own [IO does that])

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 30th May 2005, 15:29   #8
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Matthew "IGx89" Lieder
Author

KJD (archive)
-Modified to reduce size and use exdll.h
(reduced to about 6KB uncompressed, by removing CRTL dependency)

Davy Durham
-MD5.cpp fix (correct for loop used to replace memset, exceeded bounds)

Shengalts Aleksander aka Instructor
-New command: "GetMD5Random" for generate random MD5sum
-Changed names: "GetFileMD5" -> "GetMD5File", "GetMD5" -> "GetMD5String"
-Fixed: string lenght error


md5dll 0.3
Attached Files
File Type: zip md5dll.zip (10.4 KB, 773 views)
Instructor is offline   Reply With Quote
Old 16th December 2006, 10:43   #9
Clammerz
Junior Member
 
Join Date: Apr 2006
Posts: 24
Apologies for the huge bump, but I was wondering if it was possible to see some sort of progress while calculating a checksum?

On older machines, it could take quite some time to calculate a checksum for a file in the 10's of MB range, let alone larger files. So it would be nice if such progress display could be added.

I will probably use a Banner of some sort displaying "Verifying files, please wait..." or something in the meantime though, but it's not a solution I'm all that happy about : P

I feel like the user should know at all times that the installer is progressing.

Thank you very much for your time.
Clammerz is offline   Reply With Quote
Old 17th March 2009, 23:53   #10
cobra300
Junior Member
 
Join Date: Oct 2007
Posts: 3
version 1.1 seems has a bug: the result can only be pop to $0. I tried the following code:
code:

StrCpy $0 "D0"
StrCpy $1 "D1"
Crypto::HashFile "MD5" "$WINDIR\notepad.exe"
Pop $1
DetailPrint $0
DetailPrint $1


The output is:
code:

DAF60E13E96ECB67F0EDAA89C6B01B8D
D1

cobra300 is offline   Reply With Quote
Old 18th March 2009, 01:39   #11
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
you're referring to the Crypto plugin. This thread is for the MD5 plugin. For the Crypto thread, see:
http://forums.winamp.com/showthread.php?postid=1346355

Plugin URLs:
Crypto: http://nsis.sourceforge.net/Crypto_plug-in
MD5: http://nsis.sourceforge.net/MD5_plugin

For what it's worth - I did duplicate the behavior you saw - the Crypto thread seems to have other posts referring to the 'empty' result as well. I'd guess that nothing actually gets set on the stack (as the Pop results in the Errors flag being set) and instead the Crypto plugin dumps its result in $0 directly. Not a huge issue (although not encouraged), but something that should probably be noted in the docs.
Animaether is offline   Reply With Quote
Old 25th November 2013, 20:43   #12
GAG
Junior Member
 
GAG's Avatar
 
Join Date: May 2004
Location: Moscow, Russia
Posts: 15
Send a message via ICQ to GAG
Good neews!
Finally updated original Crypto Plugin!

http://nsis.sourceforge.net/Crypto_Plugin
GAG is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump