Jump to content
Sign in to follow this  
WeMartiansAreFriendly

Hashes (utilizing machine code)

Recommended Posts

WeMartiansAreFriendly

Here's an update for my original hashing function... It's still based on the same code, but I have improved it quite a bit.

Thanks to Dirk Paehl, the author of the hashes.dll, all these hashing functions are possible and..

Thanks to Ward and his Embed machine code UDF, an external dll is no longer necessary, the code from the dll is included and executed from within AutoIt. ;)

Hashes supports the following Hashing algorithms MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512 HAVAL128 HAVAL160 HAVAL192 HAVAL224 HAVAL256 GHOST TIGER128 TIGER160 TIGER192 RIPE-MD128 RIPE-MD160 CRC32 CRC16 ARC-CRC.

Limitations: I am not the author of the hashes.dll, I can not add any new hashing functions myself, nor can I support you if anything goes wrong, the UDF is of course is open source, but the hashes.dll is not. It is free for non-commercial use.

Known Plans: I'm looking to phase out the use of the hashes.dll library and write my own hashing library in c++, with none of the limitations above.

Changelog:
    v1.0a - Sep 1, 2008: 
        Minor fix for _Hashes_Init(), should be roughly 5x faster now.
    v1.0 - Sep 1, 2008: 
        Initial release.

Here's an example

#include "Hashes.au3"

Local $szInput, $szMethod, $szHash
Local $nTime = TimerInit()

_Hashes_Init()

;----------------------------------------------
; String test (sha1)
$szInput = "The quick brown fox jumps over the lazy dog" ; 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12
$szMethod = $HASHES_SHA1
$szHash = _Hashes_Lib($szInput, $szMethod, False)
ConsoleWrite( '_Hashes: ' & $szMethod & " Error: " & @error &" Value: " &  $szHash &@lf)

;----------------------------------------------
; File test (sha1)
$szInput = @ScriptFullPath
$szMethod = $HASHES_SHA1
$szHash = _Hashes_Lib($szInput, $szMethod, True)
ConsoleWrite( '_Hashes: ' & $szMethod & " Error: " & @error &" Value: " &  $szHash &@lf)

;----------------------------------------------
;Multiple method test
$szInput = "The quick brown fox jumps over the lazy dog"
Local $AV_HASHES_METHODS[21] = _
    [ _
    $HASHES_MD2,$HASHES_MD4,$HASHES_MD5, _
    $HASHES_SHA1,$HASHES_SHA256, $HASHES_SHA384, $HASHES_SHA512, _
    $HASHES_HAVAL128,$HASHES_HAVAL160,$HASHES_HAVAL192,$HASHES_HAVAL224,$HASHES_HAVAL256, _
    $HASHES_GHOST,$HASHES_TIGER128,$HASHES_TIGER160,$HASHES_TIGER192, _
    $HASHES_RIPE_MD128, $HASHES_RIPE_MD160, $HASHES_CRC32, $HASHES_CRC16, $HASHES_ARC_CRC _
    ]

For $I = 0 To UBound($AV_HASHES_METHODS)-1 Step 1
    $szMethod = $AV_HASHES_METHODS[$I]
    $szHash = _Hashes_Lib($szInput, $szMethod, False)
    ConsoleWrite( '_Hashes: ' & $szMethod & " Error: " & @error &" Value: " &  $szHash &@lf)
Next

_Hashes_End()

ConsoleWrite("time taken: "& TimerDiff($nTime) &@lf)

Exit

hashes.zip

Edited by mrRevoked

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

Share this post


Link to post
Share on other sites
AdmiralAlkex

This is great!! ;)

There is only one thing I am not clear about, when you say it is only for home use do you mean it can't be distributed for non-commercial purposes?? :D

Share this post


Link to post
Share on other sites
WeMartiansAreFriendly

This is great!! ;)

There is only one thing I am not clear about, when you say it is only for home use do you mean it can't be distributed for non-commercial purposes?? ;)

I rephrased that part.

I suppose it means you can't use it in a commercial environment or try to sell it. :D


Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

Share this post


Link to post
Share on other sites
AdmiralAlkex

I rephrased that part.

I suppose it means you can't use it in a commercial environment or try to sell it. ;)

I think I understands now, thx for a great script and answering my question :D

Share this post


Link to post
Share on other sites
Ward

Very nice! I like it~


新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了

 

Share this post


Link to post
Share on other sites
LynnS

Is there a secret to getting this to work in Windows 7? Even with the #RequireAdmin included in the Example.au3 code, I cannot get this to work. It appears to access all of the include files correctly, but no hash info is ever generated.

Has anyone come up with an easier way to generate a SHA512 hash since the posting of this code in 2008?

Share this post


Link to post
Share on other sites
spudw2k

Share this post


Link to post
Share on other sites
KaFu

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  

×