Sign in to follow this  
Followers 0
MSLx Fanboy

StringMD5

12 posts in this topic

#1 ·  Posted (edited)

Thanks to the code snippet that ter-pierre posted recently, I have converted a VBScript implementation of the MD5 algorithm into a simple AutoIt function.

This version only allows for strings, I might get around to finding FileMD5 VBscript code...

Surprisingly, with all of the &= operators in the function, it still executes fairly quickly

Test Code:

#include <StringMD5.au3>
For $x = 0 To 10
    $cookie = TimerInit()
    MsgBox(0, MD5_String(Chr(Asc('a') + $x)), TimerDiff($cookie)/1000)
Next

This script only works with the beta versions of autoit 3.1.1++ due to COM support and new operators

StringMD5.au3

Edited by MSLx Fanboy

Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites



As far as I know it will work with any windows system that has the vbscript runtime (or w/e its called) installed on the system. I would imagine that it will work without issue in 2000/XP.


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Hmmmm... This looks like something very familiar from a while ago:

http://www.autoitscript.com/forum/index.ph...indpost&p=93362

If you did not know about this then that is fine, but if you copied please give credits to the origional author: nakuribon. B)

Share this post


Link to post
Share on other sites

Hehe, oops, I never saw that. I know that when I needed MD5 hashing a while back (early Feb), nothing was available except through external DLLs. JSThePatriot has been working on either embedded functions or a plugin, either of which would be nice.

Anyways, the only code I could ever find was either C, Java, or VBScript. Since the code snippet posted above, I went back to it.

nakuribon's script is nice too, however, I believe there is too much overhead to have to "_UnHex()" the VBCode before adding it, why not just leave it as it is?

Either way, it will allow scripters to be able to support MD5 Strings in autoit without requiring external files (one of the main reasons for AutoIt: no external files needed)


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

I don't understand why an external DLL should be required to make sure that even one file has the correct MD5 or SHA-1 checksum. Being a portable automation program, I think that it should be able to natively check for data integrity.


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Here's a link to one from Manus Magnus, which is on his MMBot site.

http://perso.wanadoo.fr/manus-magnus/files/mm.MD5.Check.exe

That should do what you need, but I have a question: what exactly would you use md5 for? I haven't dealt with hashing before, and I don't really get what it's for or how it's used.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

To verify that files or character data hasn't been modified.

Many websites (including this one) use MD5 hashes for password protection, so as to protect the user's original password. If nothing is kept of the original, and it cannot be practically reversed, then the original is nearly impossible to guess.

I have personally used it when sending files via email (in an automated script). By taking the MD5 of the file before encrypting and emailing it, I can make sure that it is the same file after it is received (any data loss during transit).

Edited by MSLx Fanboy

Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0