# MD5 Hash Plug-in SHA-1

## Recommended Posts

@JSThePatriot

As a test I have installed "Dev-C++ 5 beta 9 release(4.9.9.2)" on a clean W2k Installation.

This installation was done with all the default choices.

Then I downloaded the .zip file from the forum (http://www.autoitscript.com/forum/index.php?showtopic=21010&st=32) and compiled it.

File -> Open Project or File... -> C:\dllHash4\File-String Hash.dev

Excecute -> Rebuild All

The compiler created the f-hash.dll without errors.

And the newly created f-hash.dll.dll worked without problems with the f-shash_Example.au3.

Are you sure that you are using the latest Plugin-SDK? (Mine is from 9/9/2005 and the used plugin files are in the .zip).

Dick

Yea I just downloaded the newest one. I am still stuck. Are you using my project file that I sent to you?

JS

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

• Replies 110
• Created

#### Top Posters In This Topic

Okay... I updated in the first post. I havent been able to fix the error yet. I figure I will let it relax for now as it is for future functionality. I have commented out the code.

In the first post you will now find the .dll, and all current source.

JS

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

##### Share on other sites

Yea I just downloaded the newest one. I am still stuck. Are you using my project file that I sent to you?

JS

I used your project file (the .dev) but removed your au3_plugin files and added my own. Attached is the SDK I am using. Maybe try that one and see if it works.

Dick

au3_plugin_sdk.zip

##### Share on other sites
• 1 month later...

Okay... I updated in the first post. I havent been able to fix the error yet. I figure I will let it relax for now as it is for future functionality. I have commented out the code.

In the first post you will now find the .dll, and all current source.

JS

Just thought I lett you know that I have had problems to

I did mess with the compiler flags on each file. Never could get it back to what it was suposed to be after that.

Solved it selfe when I created a new project (selected c++) and added the files from the link in your first post. I'm using w2k-sp4, dev-c++ 4.9.9.2. The windows API has package nr 3.6 in the package manager.

Thanks for strugeling with this plugin, it will ease the work for others.

##### Share on other sites

Just noticed this topic...

While I'm here doing a MD5 UDF...

Oh nevermind, I'll continue with my UDF anyway...

#)

##### Share on other sites
• 1 month later...

AFTER you change the file names inside the example, that is.

-mu

##### Share on other sites

Hello here !

I've eventually found the '#compiler_plugin_funcs = StringHash, FileHash' to get rid of the unknown function error message when running a script calling this plugin (using ALT+F5 in SciTe).

But I'm still unable to use the plugin on files which are not in the same folder.

In other words, the plugin fails when it's fed with a full path\filename and not only a filename.

Would there be a way to improve this?

##### Share on other sites

Hello here !

I've eventually found the '#compiler_plugin_funcs = StringHash, FileHash' to get rid of the unknown function error message when running a script calling this plugin (using ALT+F5 in SciTe).

But I'm still unable to use the plugin on files which are not in the same folder.

In other words, the plugin fails when it's fed with a full path\filename and not only a filename.

Would there be a way to improve this?

I will have to look into this. I am glad someone is finally finding this useful!!

Have you tried feeding it a short filename?

Thanks,

JS

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

##### Share on other sites

Just thought I lett you know that I have had problems to

I did mess with the compiler flags on each file. Never could get it back to what it was suposed to be after that.

Solved it selfe when I created a new project (selected c++) and added the files from the link in your first post. I'm using w2k-sp4, dev-c++ 4.9.9.2. The windows API has package nr 3.6 in the package manager.

Thanks for strugeling with this plugin, it will ease the work for others.

@Uten

I dont know why I didnt get emailed on this topic when you responded. I am glad I saw it today. I will have to give that a shot.

Thanks

Just noticed this topic...

While I'm here doing a MD5 UDF...

Oh nevermind, I'll continue with my UDF anyway...

#)

@nfwu

There are many UDF's Definitely continue yours. There is always more than one way to skin a cat.

@everyone

I wonder which would be faster...has anyone clocked the plugin vs one of the MD5 UDF's?

JS

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

##### Share on other sites

Hello here !

I've eventually found the '#compiler_plugin_funcs = StringHash, FileHash' to get rid of the unknown function error message when running a script calling this plugin (using ALT+F5 in SciTe).

But I'm still unable to use the plugin on files which are not in the same folder.

In other words, the plugin fails when it's fed with a full path\filename and not only a filename.

Would there be a way to improve this?

I will re-upload my .au3 code with that compiler directive at the top. I didnt know it existed. I didnt see it on any of the plugin help or in the forum. Good find.

I have tried many long filenames with spaces and all, without a glitch I get the MD5 sum...

If you could show more of what you are doing that would be great. This is what I have.

#compiler_plugin_funcs = FileHash, StringHash

Dim $something = 1$plHND = PluginOpen("f-shash.dll")
$md5String = StringHash($something)
$md5File = FileHash("C:\Documents and Settings\" & @UserName & "\My Documents\My Pictures\fiery.jpg") If Not(@error = 0) Then Exit EndIf MsgBox(0, "Test String", "String Hash: " &$md5String)
MsgBox(0, "Test File", "File Hash: " & $md5File) PluginClose($plHND)

I hope this helps,

JS

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

##### Share on other sites

Just thought I lett you know that I have had problems to

I did mess with the compiler flags on each file. Never could get it back to what it was suposed to be after that.

Solved it selfe when I created a new project (selected c++) and added the files from the link in your first post. I'm using w2k-sp4, dev-c++ 4.9.9.2. The windows API has package nr 3.6 in the package manager.

Thanks for strugeling with this plugin, it will ease the work for others.

I was unable to get it all working that way. I have all of that configured the same except i have wXP sp2.

I am content to leave it the way it is right now. In the future when I have time to add more hashes to this plugin then I will most certainly start with it again, but I also plan to have more experience in C++ by then as well.

JS

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

##### Share on other sites

Sorry for the delay.

Your new example works also fine here, however, this is what i'm trying to do:

#compiler_plugin_funcs = FileHash

Dim $fileName=FileOpenDialog("",".\", "All (*.*)") Dim$md5File
Dim $plHND = PluginOpen("f-shash.dll")$md5File   = FileHash($fileName) if @error > 0 Then MsgBox(0, "error", @error) MsgBox(0, "Test File",$fileName & @LF & "File Hash: " & $md5File) PluginClose($plHND)

I feed a *variable* containing the full path to FileHash. It seems to work fine if the file is in the same directory as the *DLL* (or a copy of it for that matter), but fails when it's not. Here is the console output when it's run from SciTE using ALT+F5:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /beta /ErrorStdOut /in "D:\install\Cuisine\AutoAnswers\test.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams

>Running AU3Check (1.54.1.1) params: from:C:\Program Files\AutoIt3\beta

+>AU3Check ended.rc:0

D:\install\Cuisine\AutoAnswers\test.au3 (7) : ==> Unknown function name.:

$md5File = FileHash($fileName)

$md5File = ^ ERROR !>AutoIT3.exe ended.rc:999 >Exit code: 999 Time: 5.360 Note that the error is odd: Unknown function name ! (while it works fine with the file beside the DLL) Also the error terminate the script, no time for displaying the error messagebox. Finally, using String() on the$fileName variable does not help.

Edited by Djé
##### Share on other sites

Hey... after a short diliberation I have figured out the differences in our scripts. I am sorry it has taken me so long to respond.

#compiler_plugin_funcs = FileHash

Dim $md5File Dim$plHND = PluginOpen("f-shash.dll")
Dim $fileName = FileOpenDialog("",".\", "All (*.*)")$md5File   = FileHash($fileName) if @error > 0 Then MsgBox(0, "error", @error) MsgBox(0, "Test File",$fileName & @LF & "File Hash: " & $md5File) PluginClose($plHND)

The differences is the FileOpenDialog() is inside the PluginOpen() function. I will bring this up to the Dev's, I am not sure if it is a bug, but we'll see.

I hope this atleast gets you going for now.

JS

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

That rocks!

thanks a lot.

##### Share on other sites

That rocks!

thanks a lot.

Not a problem. I am very happy to see someone is using my plugin! I created it a good while back, and even before that I had tried to have it included in the core.

JS

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

##### Share on other sites

Just so you know MHz explained to me that FileOpenDialog actually changes the Working Directory which is why it was required to have it after you open the plugin.

JS

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

##### Share on other sites
• 2 weeks later...

@everyone

I wonder which would be faster...has anyone clocked the plugin vs one of the MD5 UDF's?

I haven't, but I'd put money on the plug-in being MILES faster.

-mu

##### Share on other sites

I haven't, but I'd put money on the plug-in being MILES faster.

-mu

I would too... Maybe I will do some tests on some large files, and see what the results are.

JS

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

##### Share on other sites
• 2 weeks later...

Thanks again for this JS; a lovely implementation, very fast and accurate (the only md5 hash routine on this board that is both, by the way). I decided to cut it with dropping hints for SHA1, just because I need it, that's not fair, and I rolled up my sleeves and went for it. No need to worry about the cashflow thing any more!

Understand, my C skills are pretty much non-existant (I wasn't gonna let that stop me!), but with a copy of the SHA1 C++ source (from tamale.net), and no small amount of perseverance, I have managed to plug the SHA1 algorithm into your hashing plugin. After a couple of hours of WTF, I got it working; some time later, after fixing up some crazy memory leaks and what-not, it's working bloody marvellously!

There's probably still some minor memory leaking, and I'd appreciate anyone who actually knows some C/C++ to cast an eye over it (if even to prevent my n00b code escaping too far), but testing it on my bits and bobs archive, some 25,000 files, over 6GB, it hashed the lot in around four minutes, and my machine isn't fast by any standards. The SHA1 hash of a 900MB movie file is produced in under 25 seconds. On anyone else's machine, probably faster. I'd be curious to hear about that, in fact.

I noticed you had made notes about a provision for a choice of algorithm, so I implemented that, 1 (or omitted) being the default MD5 algorithm, 2 for SHA1. I also added an optional third parameter enabling you to choose the case of the hashes, 0 (or omitted) for lowercase, 1 for UPPERCASE.

So here it is, source code attached. Drop these into your current dll project (back-up first, for God's sake!) and rebuild. My own dll has been doing the business, SHA1-style, all morning, so I figured someone else might find the work useful, too.

But please, don't laugh at any *really stupid* code you might find,

I still haven't read that "C++ in 21 days" yet.

One day!

-mu

fixed the crash on zero-length strings, now it should return "da39a3ee5e6b4b0d3255bfef95601890afd80709", as expected.

SHA1_for_dllHash_src.zip

Edited by mr.underperson
##### Share on other sites

Thanks again for this JS; a lovely implementation, very fast and accurate (the only md5 hash routine on this board that is both, by the way). I decided to cut it with dropping hints for SHA1, just because I need it, that's not fair, and I rolled up my sleeves and went for it. No need to worry about the cashflow thing any more!

Understand, my C skills are pretty much non-existant (I wasn't gonna let that stop me!), but with a copy of the SHA1 C++ source (from tamale.net), and no small amount of perseverance, I have managed to plug the SHA1 algorithm into your hashing plugin. After a couple of hours of WTF, I got it working; some time later, after fixing up some crazy memory leaks and what-not, it's working bloody marvellously!

There's probably still some minor memory leaking, and I'd appreciate anyone who actually knows some C/C++ to cast an eye over it (if even to prevent my n00b code escaping too far), but testing it on my bits and bobs archive, some 25,000 files, over 6GB, it hashed the lot in around four minutes, and my machine isn't fast by any standards. The SHA1 hash of a 900MB movie file is produced in under 25 seconds. On anyone else's machine, probably faster. I'd be curious to hear about that, in fact.

I noticed you had made notes about a provision for a choice of algorithm, so I implemented that, 1 (or omitted) being the default MD5 algorithm, 2 for SHA1. I also added an optional third parameter enabling you to choose the case of the hashes, 0 (or omitted) for lowercase, 1 for UPPERCASE.

So here it is, source code attached. Drop these into your current dll project (back-up first, for God's sake!) and rebuild. My own dll has been doing the business, SHA1-style, all morning, so I figured someone else might find the work useful, too.

But please, don't laugh at any *really stupid* code you might find,

I still haven't read that "C++ in 21 days" yet.

One day!

-mu

fixed the crash on zero-length strings, now it should return "da39a3ee5e6b4b0d3255bfef95601890afd80709", as expected.

I appreciate all the hard work. I will get it added to the DLL ASAP. I like the Case option you added as well.

Look forward to getting more implemented.

Thanks,

JS

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

## 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

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...