Jump to content

_AutoMD5 - Create and test MD5 hash from string


Mechaflash
 Share

Recommended Posts

_AutoMD5 allows you to input a string password and it outputs an md5 hash for you. It also allows you to test it via a pseudo GUI login.

At the end of the script, it outputs the MD5 encrypted string as well as the source code for a simple autoit login prompt in a txt file.

Notice in the source output, _Get_Stored_Encrytped_Password() is whatever method you use to store the original encrypted password. I.E. you create the encrypted password and store it in an INI file. Replace _Get_Stored_Encrypted_Password() with a function that's made to retireve it from the INI file.

#include <Crypt.au3>

$vData = InputBox(@ScriptName, "Enter a password to encrypt.")
$sOutFile = FileSelectFolder("Select folder to output your encrypted key to.", "", 6)
If @error Then Exit
$sOutFile&="EncryptedPass.txt"
_AutoMD5_Data_Create($vData, $sOutFile)
If msgbox(4 + 32 + 262144, @ScriptName, "Do you wish to view your encrypted key?") = 6 Then ShellExecute($sOutFile)
Exit

Func _AutoMD5_Data_Create($vData, $sOutFile)
    _Crypt_StartUp()
    $sEncryptedString = _Crypt_HashData($vData, $CALG_MD5)
    If $sEncryptedString = -1 Then
        msgbox(16 + 262144, @ScriptName, "Failed to create MD5 hash. Error in command. " & @error)
        Exit
    Else
        $hFile = FileOpen($sOutFile, 2)
        FileWrite($hFile, String($sEncryptedString) & @CRLF)
        FileClose($hFile)
    EndIf
    _Crypt_Shutdown()
    If msgbox(4 + 32 + 262144, @ScriptName, "Do you wish to test the output?") = 6 Then
        $sInput = InputBox(@ScriptName, "Enter your password...")
        _AutoMD5_Test_Decryption($sInput, $sEncryptedString, $sOutFile)
    EndIf
    _AutoMD5_Create_Commands($sOutFile)
    Return $sEncryptedString
EndFunc

Func _AutoMD5_Test_Decryption($sInput, $sEncryptedString, $sOutFile)
    _Crypt_Startup()
    $sInputEncryptedString = _Crypt_HashData($sInput, $CALG_MD5)
    _Crypt_Shutdown()
    If String($sInputEncryptedString) = String($sEncryptedString) Then
        msgbox(64 + 262144, @ScriptName, "WORKS!" &@LF&@LF& _
            "Encrypted Password Shows As: " & @TAB & $sEncryptedString &@LF&@LF& _
            "The Input Password Shows As: " & @TAB & $sInputEncryptedString)
    Else
        msgbox(64 + 262144, @ScriptName, "FAILED!" &@LF&@LF& _
        "Encrypted Password Shows As: " & @TAB & $sEncryptedString &@LF&@LF& _
            "The Input Password Shows As: " & @TAB & $sInputEncryptedString)
    EndIf
EndFunc

Func _AutoMD5_Create_Commands($sOutFile)
    $hFile = FileOpen($sOutFile, 1)
    FileWrite($hFile,  @CRLF & '#include <Crypt.au3>' & @CRLF & @CRLF & _
        '$sInput = InputBox(@ScriptName, "Enter your password...")' & @CRLF & @CRLF & _
        'Func _AutoMD5_Data_Decrypt($sInput) ; Returns true if passwords match, or false if they don''t.' & @CRLF & @TAB & _
        '$sPass = _Get_Stored_Encrypted_Password() ; Retrieve the password via whatever method you choose to store it.' & @CRLF & @TAB & _
        '_Crypt_Startup()' & @CRLF & @TAB & _
        '$sEncryptedInput = _Crypt_HashData($sInput, $CALG_MD5)' & @CRLF & @TAB & _
        '_Crypt_Shutdown()' & @CRLF & @TAB & _
        'If String($sInputEncryptedString) = String($sEncryptedString) Then' & @CRLF & @TAB & @TAB & _
        'Return True' & @CRLF & @TAB & _
        'Else' & @CRLF & @TAB & @TAB & _
        'Return False' & @CRLF & @TAB & _
        'EndIf' & @CRLF & _
        'EndFunc')
    FileClose($hFile)
EndFunc

Edited by mechaflash213
Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

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

×
×
  • Create New...