Jump to content

MD5 Hash Plug-in SHA-1


JSThePatriot
 Share

Recommended Posts

(Sorry for hijacking your thread...)

You can also do this directly with AutoIt if you use the Windows Crypto API..

This is probably going to wrap horribly and its pretty long (400+ lines), but here's the code.

Save this as wincrypt.au3:

CODE: AutoIt; Crypto API Declarations
; Algorithm classes
Global Const $ALG_CLASS_ANY                   =0
Global Const $ALG_CLASS_SIGNATURE             =BitShift(1, -13)
Global Const $ALG_CLASS_MSG_ENCRYPT           =BitShift(2, -13)
Global Const $ALG_CLASS_DATA_ENCRYPT          =BitShift(3, -13)
Global Const $ALG_CLASS_HASH                  =BitShift(4, -13)
Global Const $ALG_CLASS_KEY_EXCHANGE          =BitShift(5, -13)
Global Const $ALG_CLASS_ALL                   =BitShift(7, -13)

; Algorithm types
Global Const $ALG_TYPE_ANY                    =0
Global Const $ALG_TYPE_DSS                    =BitShift(1, -9)
Global Const $ALG_TYPE_RSA                    =BitShift(2, -9)
Global Const $ALG_TYPE_BLOCK                  =BitShift(3, -9)
Global Const $ALG_TYPE_STREAM                 =BitShift(4, -9)
Global Const $ALG_TYPE_DH                     =BitShift(5, -9)
Global Const $ALG_TYPE_SECURECHANNEL          =BitShift(6, -9)

; Generic sub-ids
Global Const $ALG_SID_ANY                     =0

; Some RSA sub-ids
Global Const $ALG_SID_RSA_ANY                 =0
Global Const $ALG_SID_RSA_PKCS                =1
Global Const $ALG_SID_RSA_MSATWORK            =2
Global Const $ALG_SID_RSA_ENTRUST             =3
Global Const $ALG_SID_RSA_PGP                 =4

; Some DSS sub-ids
;
Global Const $ALG_SID_DSS_ANY                 =0
Global Const $ALG_SID_DSS_PKCS                =1
Global Const $ALG_SID_DSS_DMS                 =2

; Block cipher sub ids
; DES sub_ids
Global Const $ALG_SID_DES                     =1
Global Const $ALG_SID_3DES                    =3
Global Const $ALG_SID_DESX                    =4
Global Const $ALG_SID_IDEA                    =5
Global Const $ALG_SID_CAST                    =6
Global Const $ALG_SID_SAFERSK64               =7
Global Const $ALG_SID_SAFERSK128              =8
Global Const $ALG_SID_3DES_112                =9
Global Const $ALG_SID_CYLINK_MEK              =12
Global Const $ALG_SID_RC5                     =13
Global Const $ALG_SID_AES_128                 =14
Global Const $ALG_SID_AES_192                 =15
Global Const $ALG_SID_AES_256                 =16
Global Const $ALG_SID_AES                     =17

; Fortezza sub-ids
Global Const $ALG_SID_SKIPJACK                =10
Global Const $ALG_SID_TEK                     =11

; KP_MODE
Global Const $CRYPT_MODE_CBCI                 =6       ; ANSI CBC Interleaved
Global Const $CRYPT_MODE_CFBP                 =7       ; ANSI CFB Pipelined
Global Const $CRYPT_MODE_OFBP                 =8       ; ANSI OFB Pipelined
Global Const $CRYPT_MODE_CBCOFM               =9       ; ANSI CBC + OF Masking
Global Const $CRYPT_MODE_CBCOFMI              =10      ; ANSI CBC + OFM Interleaved

; RC2 sub-ids
Global Const $ALG_SID_RC2                     =2

; Stream cipher sub-ids
Global Const $ALG_SID_RC4                     =1
Global Const $ALG_SID_SEAL                    =2

; Diffie-Hellman sub-ids
Global Const $ALG_SID_DH_SANDF                =1
Global Const $ALG_SID_DH_EPHEM                =2
Global Const $ALG_SID_AGREED_KEY_ANY          =3
Global Const $ALG_SID_KEA                     =4

; Hash sub ids
Global Const $ALG_SID_MD2                     =1
Global Const $ALG_SID_MD4                     =2
Global Const $ALG_SID_MD5                     =3
Global Const $ALG_SID_SHA                     =4
Global Const $ALG_SID_SHA1                    =4
Global Const $ALG_SID_MAC                     =5
Global Const $ALG_SID_RIPEMD                  =6
Global Const $ALG_SID_RIPEMD160               =7
Global Const $ALG_SID_SSL3SHAMD5              =8
Global Const $ALG_SID_HMAC                    =9
Global Const $ALG_SID_TLS1PRF                 =10
Global Const $ALG_SID_HASH_REPLACE_OWF        =11
Global Const $ALG_SID_SHA_256                 =12
Global Const $ALG_SID_SHA_384                 =13
Global Const $ALG_SID_SHA_512                 =14

; secure channel sub ids
Global Const $ALG_SID_SSL3_MASTER             =1
Global Const $ALG_SID_SCHANNEL_MASTER_HASH    =2
Global Const $ALG_SID_SCHANNEL_MAC_KEY        =3
Global Const $ALG_SID_PCT1_MASTER             =4
Global Const $ALG_SID_SSL2_MASTER             =5
Global Const $ALG_SID_TLS1_MASTER             =6
Global Const $ALG_SID_SCHANNEL_ENC_KEY        =7

; Our silly example sub-id
Global Const $ALG_SID_EXAMPLE                 =80

;~ #ifndef ALGIDDEF
;~ Global Const $ALGIDDEF
;~ typedef unsigned int ALG_ID;
;~ #endif

; algorithm identifier definitions
Global Const $CALG_MD2                =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_MD2)
Global Const $CALG_MD4                =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_MD4)
Global Const $CALG_MD5                =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_MD5)
Global Const $CALG_SHA                =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_SHA)
Global Const $CALG_SHA1               =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_SHA1)
Global Const $CALG_MAC                =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_MAC)
Global Const $CALG_RSA_SIGN           =BitOR($ALG_CLASS_SIGNATURE, $ALG_TYPE_RSA, $ALG_SID_RSA_ANY)
Global Const $CALG_DSS_SIGN           =BitOR($ALG_CLASS_SIGNATURE, $ALG_TYPE_DSS, $ALG_SID_DSS_ANY)
Global Const $CALG_NO_SIGN            =BitOR($ALG_CLASS_SIGNATURE, $ALG_TYPE_ANY, $ALG_SID_ANY)
Global Const $CALG_RSA_KEYX           =BitOR($ALG_CLASS_KEY_EXCHANGE,$ALG_TYPE_RSA,$ALG_SID_RSA_ANY)
Global Const $CALG_DES                =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_DES)
Global Const $CALG_3DES_112           =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_3DES_112)
Global Const $CALG_3DES               =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_3DES)
Global Const $CALG_DESX               =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_DESX)
Global Const $CALG_RC2                =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_RC2)
Global Const $CALG_RC4                =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_STREAM,$ALG_SID_RC4)
Global Const $CALG_SEAL               =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_STREAM,$ALG_SID_SEAL)
Global Const $CALG_DH_SF              =BitOR($ALG_CLASS_KEY_EXCHANGE,$ALG_TYPE_DH,$ALG_SID_DH_SANDF)
Global Const $CALG_DH_EPHEM           =BitOR($ALG_CLASS_KEY_EXCHANGE,$ALG_TYPE_DH,$ALG_SID_DH_EPHEM)
Global Const $CALG_AGREEDKEY_ANY      =BitOR($ALG_CLASS_KEY_EXCHANGE,$ALG_TYPE_DH,$ALG_SID_AGREED_KEY_ANY)
Global Const $CALG_KEA_KEYX           =BitOR($ALG_CLASS_KEY_EXCHANGE,$ALG_TYPE_DH,$ALG_SID_KEA)
Global Const $CALG_HUGHES_MD5         =BitOR($ALG_CLASS_KEY_EXCHANGE,$ALG_TYPE_ANY,$ALG_SID_MD5)
Global Const $CALG_SKIPJACK           =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_SKIPJACK)
Global Const $CALG_TEK                =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_TEK)
Global Const $CALG_CYLINK_MEK         =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_CYLINK_MEK)
Global Const $CALG_SSL3_SHAMD5        =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_SSL3SHAMD5)
Global Const $CALG_SSL3_MASTER        =BitOR($ALG_CLASS_MSG_ENCRYPT,$ALG_TYPE_SECURECHANNEL,$ALG_SID_SSL3_MASTER)
Global Const $CALG_SCHANNEL_MASTER_HASH   =BitOR($ALG_CLASS_MSG_ENCRYPT,$ALG_TYPE_SECURECHANNEL,$ALG_SID_SCHANNEL_MASTER_HASH)
Global Const $CALG_SCHANNEL_MAC_KEY   =BitOR($ALG_CLASS_MSG_ENCRYPT,$ALG_TYPE_SECURECHANNEL,$ALG_SID_SCHANNEL_MAC_KEY)
Global Const $CALG_SCHANNEL_ENC_KEY   =BitOR($ALG_CLASS_MSG_ENCRYPT,$ALG_TYPE_SECURECHANNEL,$ALG_SID_SCHANNEL_ENC_KEY)
Global Const $CALG_PCT1_MASTER        =BitOR($ALG_CLASS_MSG_ENCRYPT,$ALG_TYPE_SECURECHANNEL,$ALG_SID_PCT1_MASTER)
Global Const $CALG_SSL2_MASTER        =BitOR($ALG_CLASS_MSG_ENCRYPT,$ALG_TYPE_SECURECHANNEL,$ALG_SID_SSL2_MASTER)
Global Const $CALG_TLS1_MASTER        =BitOR($ALG_CLASS_MSG_ENCRYPT,$ALG_TYPE_SECURECHANNEL,$ALG_SID_TLS1_MASTER)
Global Const $CALG_RC5                =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_RC5)
Global Const $CALG_HMAC               =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_HMAC)
Global Const $CALG_TLS1PRF            =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_TLS1PRF)
Global Const $CALG_HASH_REPLACE_OWF   =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_HASH_REPLACE_OWF)
Global Const $CALG_AES_128            =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_AES_128)
Global Const $CALG_AES_192            =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_AES_192)
Global Const $CALG_AES_256            =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_AES_256)
Global Const $CALG_AES                =BitOR($ALG_CLASS_DATA_ENCRYPT,$ALG_TYPE_BLOCK,$ALG_SID_AES)
Global Const $CALG_SHA_256            =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_SHA_256)
Global Const $CALG_SHA_384            =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_SHA_384)
Global Const $CALG_SHA_512            =BitOR($ALG_CLASS_HASH, $ALG_TYPE_ANY, $ALG_SID_SHA_512)

Global Const $CRYPT_VERIFYCONTEXT     =0xF0000000
Global Const $CRYPT_NEWKEYSET         =0x00000008
Global Const $CRYPT_DELETEKEYSET      =0x00000010
Global Const $CRYPT_MACHINE_KEYSET    =0x00000020
Global Const $CRYPT_SILENT            =0x00000040

Global Const $PROV_RSA_FULL           =1
Global Const $PROV_RSA_SIG            =2
Global Const $PROV_DSS                =3
Global Const $PROV_FORTEZZA           =4
Global Const $PROV_MS_EXCHANGE        =5
Global Const $PROV_SSL                =6
Global Const $PROV_RSA_SCHANNEL       =12
Global Const $PROV_DSS_DH             =13
Global Const $PROV_EC_ECDSA_SIG       =14
Global Const $PROV_EC_ECNRA_SIG       =15
Global Const $PROV_EC_ECDSA_FULL      =16
Global Const $PROV_EC_ECNRA_FULL      =17
Global Const $PROV_DH_SCHANNEL        =18
Global Const $PROV_SPYRUS_LYNKS       =20
Global Const $PROV_RNG                =21
Global Const $PROV_INTEL_SEC          =22
Global Const $PROV_REPLACE_OWF        =23
Global Const $PROV_RSA_AES            =24

Global Const $NTE_BAD_KEYSET                   =0x80090016
; MessageId: NTE_BAD_KEYSET_PARAM
Global Const $NTE_BAD_KEYSET_PARAM             =0x8009001F

Global Const $HP_ALGID                =0x0001  ; Hash algorithm
Global Const $HP_HASHVAL              =0x0002  ; Hash value
Global Const $HP_HASHSIZE             =0x0004  ; Hash value size
Global Const $HP_HMAC_INFO            =0x0005  ; information for creating an HMAC
Global Const $HP_TLS1PRF_LABEL        =0x0006  ; label for TLS1 PRF
Global Const $HP_TLS1PRF_SEED         =0x0007  ; seed for TLS1 PRF

#include-once
#include "wincrypt.au3"

; Crypto API Functions
;
; Specifically tailored to the MD5 algorithm.
;
; You will need the Microsoft SDK to fully understand what
; is going on here. I only highlight specifics that can
; bite you in the bum if you aren't paying attention.

;~ BOOL WINAPI CryptAcquireContext(
;~   HCRYPTPROV* phProv,
;~   LPCTSTR pszContainer,
;~   LPCTSTR pszProvider,
;~   DWORD dwProvType,
;~   DWORD dwFlags
;~ );
Func getContext()
    Local $shprov = DllStructCreate("dword")
    if @error<>0 Then
        SetError(99)
        Return 0
    EndIf
    Local $res = DllCall("advapi32.dll", "long", "CryptAcquireContextA", _
                        "ptr", DllStructGetPtr($shprov), _
                        "ptr", 0, _
                        "ptr", 0, _
                        "long", $PROV_RSA_FULL, _
                        "long", 0)

    If @error=0 And $res[0]<>0 Then
        Return DllStructGetData($shprov, 1)
    ElseIf @error=0 Then
        $res = DllCall("kernel32.dll", "long", "GetLastError")
        If $res[0]=$NTE_BAD_KEYSET Then
            $res = DllCall("advapi32.dll", "long", "CryptAcquireContextA", _
                            "ptr", DllStructGetPtr($shprov), _
                            "ptr", 0, _
                            "ptr", 0, _
                            "long", $PROV_RSA_FULL, _
                            "long", $CRYPT_NEWKEYSET)

            If @error=0 And $res[0]<>0 Then
                Return DllStructGetData($shprov, 1)
            ElseIf @error=0 Then
                $res = DllCall("kernel32.dll", "long", "GetLastError")
                SetError(1, $res[0])
                Return 0
            Else
                SetError(98)
                Return 0
            EndIf
        Else
            SetError($res[0])
            Return 0
        EndIf
    Else
        SetError(97)
        Return 0
    EndIf
EndFunc

;~ BOOL WINAPI CryptReleaseContext(
;~   HCRYPTPROV hProv,
;~   DWORD dwFlags
;~ );
Func loseContext($hprov)
    Local $res = DllCall("advapi32.dll", "long", "CryptReleaseContext", "long", $hprov, "long", 0)
    SetError(@error)
    if @error=0 Then
        Return $res[0]
    EndIf
EndFunc

;~ BOOL WINAPI CryptCreateHash(
;~   HCRYPTPROV hProv,
;~   ALG_ID Algid,
;~   HCRYPTKEY hKey,
;~   DWORD dwFlags,
;~   HCRYPTHASH* phHash
;~ );
Func getHash($hprov)
    Local $hHash = DllStructCreate("dword")
    if @error<>0 Then
        SetError(99)
        Return 0
    EndIf
    
    Local $res = DllCall("advapi32.dll", "long", "CryptCreateHash", _
                        "long", $hprov, _
                        "long", $CALG_MD5, _
                        "long", 0, _
                        "long", 0, _
                        "ptr", DllStructGetPtr($hHash))
    if @error=0 Then
        if $res[0]<>0 Then
            Return DllStructGetData($hHash, 1)
        Else
            $res = DllCall("kernel32.dll", "long", "GetLastError")
            SetError(1, $res[0])
            Return 0
        EndIf
    Else
        SetError(98)
        Return 0
    EndIf
EndFunc

;~ BOOL WINAPI CryptDestroyHash(
;~   HCRYPTHASH hHash
;~ );
Func smokeHash($hHash)
    Local $res = DllCall("advapi32.dll", "long", "CryptDestroyHash", "long", $hHash)
    SetError(@error)
    if @error=0 Then
        Return $res[0]
    EndIf
EndFunc

;~ BOOL WINAPI CryptHashData(
;~   HCRYPTHASH hHash,
;~   BYTE* pbData,
;~   DWORD dwDataLen,
;~   DWORD dwFlags
;~ );
Func doHash($hHash, $bData, $cbData)
    Local $sdata = DllStructCreate("byte[" & $cbData & "]")
    If @error<>0 Then
        SetError(99)
        Return 0
    EndIf
    
    DllStructSetData($sdata, 1, $bData)
    If @error<>0 Then
        SetError(99)
        Return 0
    EndIf
    
    Local $res = DllCall("advapi32.dll", "long", "CryptHashData", _
                        "long", $hHash, _
                        "ptr", DllStructGetPtr($sdata), _
                        "long", $cbData, _
                        "long", 0)
    SetError(@error)
    if @error=0 And $res[0]<>0 Then
        Return $res[0]
    ElseIf @error=0 Then
        $res = DllCall("kernel32.dll", "long", "GetLastError")
        SetError(1, $res[0])
        return 0
    Else
        SetError(98)
        Return 0
    EndIf
EndFunc

;~ BOOL WINAPI CryptGetHashParam(
;~   HCRYPTHASH hHash,
;~   DWORD dwParam,
;~   BYTE* pbData,
;~   DWORD* pdwDataLen,
;~   DWORD dwFlags
;~ );
;
; From MSDN:
;
;~  The CryptGetHashParam function completes the hash. After
;~  CryptGetHashParam has been called, no more data can be added
;~  to the hash. Additional calls to CryptHashData or
;~  CryptHashSessionKey fail. After the application is done with
;~  the hash, CryptDestroyHash [NB; smokeHash()] should be called
;~  to destroy the hash object.
;
Func findHash($hHash)

    Local $sHashLen = DllStructCreate("dword")
    if @error<>0 Then
        SetError(99)
        Return 0
    EndIf

    Local $sCount = DllStructCreate("dword")
    if @error<>0 Then
        SetError(98)
        Return 0
    EndIf
    DllStructSetData($sCount, 1, DllStructGetSize($sHashLen))

    Local $res = DllCall("advapi32.dll", "long", "CryptGetHashParam", _
                        "long", $hHash, _
                        "long", $HP_HASHSIZE, _
                        "ptr", DllStructGetPtr($sHashLen), _
                        "ptr", DllStructGetPtr($sCount), _
                        "long", 0)

    if @error=0 And $res[0]<>0 Then
        Local $sbHash = DllStructCreate("byte[" & DllStructGetData($sHashLen, 1) & "]")
        If @error<>0 Then
            SetError(@error)
            Return 0
        EndIf
        $res = DllCall("advapi32.dll", "long", "CryptGetHashParam", _
                        "long", $hHash, _
                        "long", $HP_HASHVAL, _
                        "ptr", DllStructGetPtr($sbHash), _
                        "ptr", DllStructGetPtr($sHashLen), _
                        "long", 0)
        SetError(@error)
        If @error=0 And $res[0]<>0 Then
            Local $md5 = ""
            Local $c = DllStructGetData($sHashLen, 1)
            For $i = 1 to $c
                $md5 &= StringFormat("%2.2x", BitAND(DllStructGetData($sbHash, 1, $i), 0xFF))
            Next
            Return $md5
        Elseif @error=0 Then
            $res = DllCall("kernel32.dll", "long", "GetLastError")
            SetError(1, $res[0])
            return 0
        EndIf
    ElseIf @error=0 Then
        If $res[0]=0 Then
            $res = DllCall("kernel32.dll", "long", "GetLastError")
            SetError(1, $res[0])
            return 0
        EndIf
    Else
        SetError(97)
        Return 0
    EndIf
EndFunc

;
; Here's how to use it...
;
Func testHash($bData)
    Local $ctx = getContext()
    if @error=0 Then
        Local $hHash = getHash($ctx)
        if @error=0 and $hHash<>0 Then
            Local $bHashed = doHash($hHash, $bData, StringLen($bData))
            if @error=0 And $bHashed<>0 Then
                MsgBox(0, "Success", "We did hash.")
                $rhash = findHash($hHash)
                If @error=0 Then
                    MsgBox(0, "Smoked it too.", $rhash)
                Else
                    MsgBox(0, "Error", "It didn't light: " & @extended)
                EndIf
            EndIf
            smokeHash($hHash)
        Else
            MsgBox(0, "Error", "No hashish today.")
        EndIf
        loseContext($ctx)
    Else
        MsgBox(0, "Error", "No context.")
    EndIf
EndFunc
Edited by Jon
Link to comment
Share on other sites

  • Replies 110
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

nevermind,

now it's working :)

$hash = MD5Hash(MD5Hash("pass", 2, False) & "salt", 2, False)

I am very happy to hear you have your problem solved. I didn't get an email to this thread so that is the reason for my delayed response. I apologize for it.

Thanks,

JS

AutoIt Links

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

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

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

Link to comment
Share on other sites

(Sorry for hijacking your thread...)

You can also do this directly with AutoIt if you use the Windows Crypto API..

This is probably going to wrap horribly and its pretty long (400+ lines), but here's the code.

If you could please put your code in [ codebox ] 's without the spaces of course. That would help people not to have to scroll so far. I would appreciate that. I have no problem with people offering alternate solutions. I rather appreciate it, but please keep the scrolling to a limited amount :-D

Thanks,

JS

Edited by Jon

AutoIt Links

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

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

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

Link to comment
Share on other sites

  • 1 month later...
  • 6 months later...

Does anyone have a working md5 script for vista x64? i have tried every code i can find and none seem to work for me. :)

How about making it work on generating a proper hash for Grub (like Grub for Dos).

Grub appears to use a salt that is in plain view in the hash. It starts with $1$.......$hash

For instance:

Salt = $1$123456$

Password = password

$1$123456$qqQvjw0PqIk7otmzNsUIN0

Can't figure out how to get this to work when using a salt especially the way that Grub uses it.

Edited by powaking
Link to comment
Share on other sites

I love you. :)

$key = StringLower(MD5Hash($challenge & $clientID, 2, True))
            $response = "QRY " & $trID & " msmsgs@msnmsgr.com 32" & @CRLF & $key
            TCPSend($MSN_SOCKET, $response)

Had to use it in my MSN Client for the challenge response :)

Thanks JSThePatriot!

ps. can it return the hash in lowercase? if not, stringlower solves it.. just wondering ds.

Edited by karman
Link to comment
Share on other sites

  • 1 month later...

Hey guys, I have a question..

I have been reading through these pages for a while now, only to be more lost than before.

I am looking for something to check the md5 hash's of two files, compair them, and the rest is what I can finish up.

So, is there something I am missing, or is this not the thread for me ?

Link to comment
Share on other sites

I love you. ;)

$key = StringLower(MD5Hash($challenge & $clientID, 2, True))
            $response = "QRY " & $trID & " msmsgs@msnmsgr.com 32" & @CRLF & $key
            TCPSend($MSN_SOCKET, $response)

Had to use it in my MSN Client for the challenge response :P

Thanks JSThePatriot!

ps. can it return the hash in lowercase? if not, stringlower solves it.. just wondering ds.

karman,

I am sorry for taking so long in replying. If you put False instead of True as the last parameter, it will be in lower case.

Hey guys, I have a question..

I have been reading through these pages for a while now, only to be more lost than before.

I am looking for something to check the md5 hash's of two files, compair them, and the rest is what I can finish up.

So, is there something I am missing, or is this not the thread for me ?

eliteapu,

This is probably what you are looking for. All you need is the DLL, and a quick look at the example. You will have to create the two hashes from the files, and then compare them using AutoIt.

I hope this helps you guys. Thanks for your interest in this project!

JS

AutoIt Links

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

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

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

Link to comment
Share on other sites

  • 3 weeks later...

Hey JSThePatriot,

Just an FYI, a couple of the download links are not working. I get an error page when I try to download the MD5Hash.dll and SHAHash.dll. Everything else seems to be working fine.

I tried to download it on a couple of computers in different locations.

Regards,

TheCuz

[font="Verdana"]People who say it cannot be done should not interrupt those who are doing it. - George Benard Shaw[/font]

Link to comment
Share on other sites

  • 4 months later...

I wanted to update anyone that is still subscribed to this thread that it is now released under the LGPL. This is my first time to release any of my software offerings under any license, and I hope I have done everything right.

Thanks,

JS

AutoIt Links

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

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

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

Link to comment
Share on other sites

  • 2 weeks later...

I wanted to update anyone that is still subscribed to this thread that it is now released under the LGPL. This is my first time to release any of my software offerings under any license, and I hope I have done everything right.

Thanks,

JS

Ok, just a question without reading the entire LGPL. Can I still use your dll's in my software, even if I would sell my software?
Link to comment
Share on other sites

Well after using your work i'd like to contribute something:

I found myself in the same situation like some posters before me have, an invalid function call. Also i KNOW and CHECKED that the plugin is properly loaded and closed. I shifted it out of functions into new one declared the plugin global and whatnot...I finally got it working reliable again. Again because sometimes it DID work. After reading on some page here about the working directory it came to my mind that i never exactly specified the location of the .dll but rather passed just the filename. As already mentioned it does seem to have conflicts if you use another directory besides the one where the .dll is. FileOpen/FileOpenDialog seem to cause this bug(?) pretty often(cos they change the @workingdir or so i heard) but not always and i couldn't answer why.

Moral of my horrible writeup/rambling: when opening a .dll as a plugin, put in the full path to the file or atleast something like this:

PluginOpen(@ScriptDir & "\MD5Hash.dll")

p.s. i might have confused everything at night if so tell me fast so i might delete this :D

Link to comment
Share on other sites

  • 2 weeks later...

Hey there, i'm noob with all things that regards .dlls and so...

What is the difference between using the MD5.dll file and the MD5 encryption UDF made in AU3 ?

thanks in advance and sorry for asking noob questions!!!

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

  • 3 weeks later...

I've been trying to get this to work, but I can't seem to get the plugin to open properly

When I run this simple test code:

$PluginHandle = PluginOpen(@ScriptDir & "\MD5Hash.dll")
;$PluginHandle = PluginOpen("D:\temp\MD5Hash.dll")
    
    IF FileExists(@ScriptDir & "\MD5Hash.dll") = 0 Then
        msgbox(0,"Error","File does not exsist")
        Exit
    EndIf   
    
    IF $PluginHandle = 0 then
        msgbox(0,"Error","plugin did not open properly")
        Exit
    EndIf

$Hash = MD5Hash("lolhi2u!", 2, True)

PluginClose($PluginHandle)


msgbox(0,"Hash",$Hash)

I get the Error message box

Now of course I have MD5Hash.dll, in the same directory as this test script. I've tested both using @ScriptDir, as well as the actual script directory. I've tried using v3.2.12.0 as well as v3.2.11.12 (beta). Any help would be appreciated.

Edited by BotXpert
Link to comment
Share on other sites

This is awesome to make a rainbow table.

Since you can encrypt wordlists really fast.

#include <File.au3>

Global Const $nWordlist = "data.txt"
Global Const $nEncrypt = "new.txt"

$plH = PluginOpen("plugin\MD5Hash.dll")

For $x = 1 To _FileCountLines($nWordlist)
    $sFile = FileReadLine($nWordlist, $x)
    FileWrite($nEncrypt, MD5Hash($sFile, 2, True) & @CRLF)
Next

PluginClose($plH)

And then just compare the md5 hash with the hash in your ''new.txt''

Thanks for this. Im going to work on an offline autoit md5 rainbow table.

Edited by SKANKS
Link to comment
Share on other sites

Just to let you know, just storing the hashes of the words is not a Rainbow Table, as rainbow tables don't store the hashes, but algorithms and patterns that work out to be the hash/word. It's a little complicated. You will have a precomputed Dictionary if you do as you have shown.

Link to comment
Share on other sites

This is awesome to make a rainbow table.

Since you can encrypt wordlists really fast.

#include <File.au3>

Global Const $nWordlist = "data.txt"
Global Const $nEncrypt = "new.txt"

$plH = PluginOpen("plugin\MD5Hash.dll")

For $x = 1 To _FileCountLines($nWordlist)
    $sFile = FileReadLine($nWordlist, $x)
    FileWrite($nEncrypt, MD5Hash($sFile, 2, True) & @CRLF)
Next

PluginClose($plH)

And then just compare the md5 hash with the hash in your ''new.txt''

Thanks for this. Im going to work on an offline autoit md5 rainbow table.

Ok, you said you can encrypt worldlists "really fast", but in my eyes this solution is only programmed "really fast" but the resulting program is actually not very fast at all. I can recommend if you are going to calculate hashes of words anyway, use a different language ( C++ recommended ) to calculate the hashes.

Also, like SkinnyWhiteGuy mentioned, Rainbow Tables are not a collection of hashes. :)

Edit: Here, have a look actually: http://www.manadar.com/repository/wordlist.zip (85 MB)

Edited by Manadar
Link to comment
Share on other sites

Ok, you said you can encrypt worldlists "really fast", but in my eyes this solution is only programmed "really fast" but the resulting program is actually not very fast at all. I can recommend if you are going to calculate hashes of words anyway, use a different language ( C++ recommended ) to calculate the hashes.

Also, like SkinnyWhiteGuy mentioned, Rainbow Tables are not a collection of hashes. :)

Edit: Here, have a look actually: http://www.manadar.com/repository/wordlist.zip (85 MB)

Brute-forcing is more fun :)

But I would never do something like that :)

[/off topic]

I like this plug-in. I hope I'm not to late to comment :P

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...