Ward Posted September 27, 2008 Share Posted September 27, 2008 (edited) Here are already too many hash UDF. However, I hope this one is the simplest and the fast.These algorithms are written by Projet RNRT SAPHIR (except CRC32, Alder, GOST), modify and compile to DLL by me.And I use MemoryDLL UDF to let the DLL work like a pure script.This UDF only have two functions: _Hash($Type, $Data), and _HashFile($Type, $File)Where $Type is a string to specify what algorithm to use, for example, "md5" or "sha1"Hash39.au3 and Hash9.au3 are identical except the DLL used by Hash39.au3 has more algorithms.The algorithms list:Hash9: MD5, SHA1, SHA224, SHA256, SHA384, SHA512, CRC16, CRC32, and ADLER32. Hash39: All in Hash9 plus MD2, MD4, ED2K, PANAMA, RIPEMDn(n = 128, 160, 256, 320), SHA0(original SHA), TIGER, TIGER2(Tiger with a modified padding), WHIRLPOOL(2003), WHIRLPOOL0(2000), WHIRLPOOL1(2001), GOST, and HAVALn_m(n = 128, 160, 192, 224, 256; m = 3, 4, 5, for example: HAVAL128_3) Hash39DLL.au3 and Hash9Dll.au3 are the alternative version. They don't use MemoryDLL UDF.An example:#include "Hash39.au3" $Timer = TimerInit() $Hash = _Hash("md5", "The quick brown fox jumps over the lazy dog") MsgBox(0, TimerDiff($Timer), $Hash) $Timer = TimerInit() $Hash = _Hash("sha1", "The quick brown fox jumps over the lazy dog") MsgBox(0, TimerDiff($Timer), $Hash) $Timer = TimerInit() $Hash = _Hash("haval128_3", "The quick brown fox jumps over the lazy dog") MsgBox(0, TimerDiff($Timer), $Hash) $Timer = TimerInit() $Hash = _Hash("whirlpool", "The quick brown fox jumps over the lazy dog") MsgBox(0, TimerDiff($Timer), $Hash)2008/09/28 Update Note:Fix a major bug that may cause crash.Add GOST hash algorithm.2008/12/06 Update Note:Add some algorithm. Less size and more speed.Update MemoryDll.au3, now worked under Vista.Hash.zip Edited December 8, 2008 by Ward 新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了。 Link to comment Share on other sites More sharing options...
TehWhale Posted September 27, 2008 Share Posted September 27, 2008 Doesn't work. The returned value is not an array. The Hash call fails. Link to comment Share on other sites More sharing options...
Ward Posted September 27, 2008 Author Share Posted September 27, 2008 Doesn't work. The returned value is not an array. The Hash call fails.The returned value shoud be a string in HEX format, not an array.May be you can post your code, and then I can test and see what's wrong. 新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了。 Link to comment Share on other sites More sharing options...
TehWhale Posted September 27, 2008 Share Posted September 27, 2008 (edited) No, is what im saying is that after your DllCall, you have Return $Ret[0], $Ret isn't an error, so it fails, saying....blah you know. EDIT: I'm using your example in your zip. Edited September 27, 2008 by Alienware Link to comment Share on other sites More sharing options...
Ward Posted September 27, 2008 Author Share Posted September 27, 2008 You mean DllCall or MemoryDllCall? The hash script don't use any build-in DllCall. 新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了。 Link to comment Share on other sites More sharing options...
TehWhale Posted September 27, 2008 Share Posted September 27, 2008 This function.Func _Hash($Type, $Data) If Not IsNumber($__HashDll) Then $__HashDll = MemoryDllOpen($__HashDllCode) Local $Buffer = DllStructCreate('byte[' & BinaryLen($Data) & ']') DllStructSetData($Buffer, 1, $Data) Local $Ret = MemoryDllCall($__HashDll, "str", "hash", "str", $Type, "ptr", DllStructGetPtr($Buffer), "uint", BinaryLen($Data)) Return $Ret[0] EndFuncIt Cannot Return an Array, because $Ret is not an array. Link to comment Share on other sites More sharing options...
Ward Posted September 27, 2008 Author Share Posted September 27, 2008 (edited) So what you mean is MemoryDllCall..... Do you have tested other script using MemoryDllCall? Or even machine code? I don't know if MemoryDllCall work under vista. Because I don't have a vista system to test. If it is not, maybe you can only use them as a normal DLL. But it no more a pure scirpt. I upload a normal DLL version, you can test it. Edited September 27, 2008 by Ward 新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了。 Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted September 28, 2008 Share Posted September 28, 2008 (edited) Wow very nice job! Impressive amount of algorithms Tested working on.. Windows XP Professional SP2 Windows Vista Home Premium A few questions.. Why is there so many HAVAL functions? and could you post the source code for the Hash36.dll and Hash8.dll? CODE HAVAL128_3 HAVAL128_4 HAVAL128_5 HAVAL160_3 HAVAL160_4 HAVAL160_5 HAVAL192_3 HAVAL192_4 HAVAL192_5 HAVAL224_3 HAVAL224_4 HAVAL224_5 HAVAL256_3 HAVAL256_4 HAVAL256_5 MD2 MD4 MD5 PANAMA RIPEMD128 RIPEMD160 RIPEMD SHA0 SHA1 SHA224 SHA256 SHA384 SHA512 TIGER2 TIGER WHIRLPOOL0 WHIRLPOOL1 WHIRLPOOL CRC32 ADLER32 GOST Edited September 28, 2008 by mrRevoked Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted September 28, 2008 Share Posted September 28, 2008 (edited) Alienware is right, the machine code version does not work on Vista, But it works just fine on Windows XP... Edited September 28, 2008 by mrRevoked Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted September 28, 2008 Share Posted September 28, 2008 Haval is the generic function, it supports multiple output lengths, as well as multiple internal pass values. Lengths are 128, 160, 192, 224, 256. Passes are 3, 4, 5. That's why there's so many of those. As to wanting source for these, just lookup the rehash project on Sourceforge, all these (except Whirlpool and Panama) are in there. A little snooping on the web will help you find the others. If I ever get around to it, I have something similar to all this to show as well, though ward's solution will still be faster. Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted September 28, 2008 Share Posted September 28, 2008 A while ago I did look at rehash, it is a command line app, but it seems like converting and compiling it as a dll would be a tedious task. It would be interesting to see these algorithms implement in AutoIt. (assuming that's what meant ) Thanks. Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
trancexx Posted September 28, 2008 Share Posted September 28, 2008 (edited) Great dll. Too bad that for some reason it doesn't work on Vista (MemoryDllCall). As far as I can see the problem is in this line of MemoryDll.au3: Local $Module = DllCall($_MDKernel32Dll, "uint", $_MFHookApi, "uint", $LoadLibraryA[0], "uint", $GetProcAddress[0], "ptr", DllStructGetPtr($DllBuffer)) $Module[0] is 0 This $_MFHookApi ("LocalCompact"), is obviously crucial and it's not working with vista.(I edited this part - was trying to provoke the reaction, but nothing ) I like the idea of compressing the originall dll to reduce the size of the scripts. Actually it's quite ingenious. edit: I tried MemoryDllCall() with other dll on vista and works fine, so it's not "LocalCompact", something else causes the problem Edited September 29, 2008 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Ward Posted December 6, 2008 Author Share Posted December 6, 2008 Great dll. Too bad that for some reason it doesn't work on Vista (MemoryDllCall). As far as I can see the problem is in this line of MemoryDll.au3: Local $Module = DllCall($_MDKernel32Dll, "uint", $_MFHookApi, "uint", $LoadLibraryA[0], "uint", $GetProcAddress[0], "ptr", DllStructGetPtr($DllBuffer)) $Module[0] is 0 This $_MFHookApi ("LocalCompact"), is obviously crucial and it's not working with vista.(I edited this part - was trying to provoke the reaction, but nothing ) I like the idea of compressing the originall dll to reduce the size of the scripts. Actually it's quite ingenious. edit: I tried MemoryDllCall() with other dll on vista and works fine, so it's not "LocalCompact", something else causes the problem LocalCompact is obsolete under win32, but its entry point is still preserved for compatibility. I just use it as a bridge between AutoIt DllCall and dll entry point. It is not the key point to the problem. I fixed some problem at MemoryDllCall, please try it under Vista again. It should work now. 新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了。 Link to comment Share on other sites More sharing options...
trancexx Posted December 7, 2008 Share Posted December 7, 2008 LocalCompact is obsolete under win32, but its entry point is still preserved for compatibility.I just use it as a bridge between AutoIt DllCall and dll entry point. It is not the key point to the problem.I fixed some problem at MemoryDllCall, please try it under Vista again. It should work now.Yes, works fine now.Problem is solved outside autoit code?I can see changes to assembly code used. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
tip Posted May 10, 2009 Share Posted May 10, 2009 (edited) Thanks for sharing it... It is really fast and so easy to use. Plus there is so many algorithms. It's really fantastic... Is there a way to monitor the progress?? I can create a progress bar with your other Hash Tools (http://www.autoitscript.com/forum/index.php?showtopic=76976) but these are more than two times faster... P.S:Sorry to bump an old one... Sincerely Tip Edited May 10, 2009 by tip [center]MsgBox_Tipped: Eye candy msgboxes/inputboxes/loginboxes. | CreateBlankBox: Semi-transparent layers with borders and rounded corners.[/center] Link to comment Share on other sites More sharing options...
Ward Posted May 16, 2009 Author Share Posted May 16, 2009 Thanks for sharing it... It is really fast and so easy to use. Plus there is so many algorithms. It's really fantastic...Is there a way to monitor the progress?? I can create a progress bar with your other Hash Tools (http://www.autoitscript.com/forum/index.php?showtopic=76976) but these are more than two times faster...P.S:Sorry to bump an old one...Sincerely TipFor this UDF, sorry no way to monitor the progress.If you really want to, I cound modify this UDF. But only if I have free time to do this. 新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了。 Link to comment Share on other sites More sharing options...
Jman Posted September 16, 2009 Share Posted September 16, 2009 Might be late but when I goto extract the .zip file my av displays TR/Crypt.XPACK.Gen is that something that is required? Link to comment Share on other sites More sharing options...
sbonacina Posted September 28, 2009 Share Posted September 28, 2009 Might be late but when I goto extract the .zip file my av displays TR/Crypt.XPACK.Gen is that something that is required?I've got the same problem, related only to Hash9.dllWard, can you please have a look at it?Thanks for your helpStefano Link to comment Share on other sites More sharing options...
tkocsir Posted October 18, 2011 Share Posted October 18, 2011 Can somebody post a working hash39.dll? It still does not work on Windows 7. The problem is written in the sixth comment. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now