 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
olfen
Joined: 04 Jun 2005 Posts: 113 Location: Stuttgart, Germany
|
Posted: Wed Sep 26, 2007 5:46 pm Post subject: |
|
|
| Thanks, Sean! |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Mon Oct 01, 2007 5:51 am Post subject: |
|
|
I combined the recent AES.ahk and Hash.ahk into StandardLibrary File.ahk.
Example:
| Code: | sFileOriginl := A_AhkPath ; Specify the real file path here!
sPassword := "AutoHotkey" ; Specify your own password here!
SID := 128 ; 128bit AES
sFileEncrypt := A_Temp . "\encrypt" . SID . ".bin" ; Specify encrypted file path.
sFileDecrypt := A_Temp . "\decrypt" . SID . ".exe" ; Specify decrypted file path.
File_AES(sFileOriginl, sFileEncrypt, sPassword, SID, True) ; Encryption
File_AES(sFileEncrypt, sFileDecrypt, sPassword, SID, False) ; Decryption
SID := 192 ; 192bit AES
sFileEncrypt := A_Temp . "\encrypt" . SID . ".bin"
sFileDecrypt := A_Temp . "\decrypt" . SID . ".exe"
File_AES(sFileOriginl, sFileEncrypt, sPassword, SID, True) ; Encryption
File_AES(sFileEncrypt, sFileDecrypt, sPassword, SID, False) ; Decryption
SID := 256 ; 256bit AES
sFileEncrypt := A_Temp . "\encrypt" . SID . ".bin"
sFileDecrypt := A_Temp . "\decrypt" . SID . ".exe"
File_AES(sFileOriginl, sFileEncrypt, sPassword, SID, True) ; Encryption
File_AES(sFileEncrypt, sFileDecrypt, sPassword, SID, False) ; Decryption
MsgBox, % "CRC32:`t" . File_Hash(sFileOriginl, "CRC32") . "`n"
. "MD5:`t" . File_Hash(sFileOriginl, "MD5") . "`n"
. "SHA1:`t" . File_Hash(sFileOriginl, "SHA1") . "`n"
|
|
|
| Back to top |
|
 |
Theolonious
Joined: 05 Jan 2008 Posts: 2 Location: syracuse,ny
|
Posted: Tue Jan 08, 2008 7:34 pm Post subject: |
|
|
[quote="majkinetor"] | Quote: |
Sad to know you have grown up. My deepest symphaties.  |
I tell my Girlfriend that all men are 12 years old. Otherwise we would not have so many toys. 13 is bad luck and over the hill.
My apologies for posting to an old message but i could not resist. |
|
| Back to top |
|
 |
Tuncay
Joined: 07 Nov 2006 Posts: 1886 Location: Germany
|
Posted: Tue Mar 09, 2010 4:00 am Post subject: |
|
|
Edit: My usage was not correct! sorry forget about this post.
The Crypt_Hash() does not calculate / get correct md5. I am using Vista here.
| Code: | ; #Include Crypt.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
V := "The quick brown fox jumps over the lazy dog"
L := StrLen(V)
MsgBox,, MD5 with Crypt_Hash(), % V . ":`n`n" . Crypt_Hash(V, L, "MD5") |
_________________ {1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--
Last edited by Tuncay on Wed Mar 10, 2010 11:43 am; edited 1 time in total |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Wed Mar 10, 2010 12:20 am Post subject: |
|
|
Your usage is wrong.
| Code: | | Crypt_Hash(&V, L, "MD5") |
|
|
| Back to top |
|
 |
Tuncay
Joined: 07 Nov 2006 Posts: 1886 Location: Germany
|
|
| Back to top |
|
 |
PanicSwitch Guest
|
Posted: Tue Mar 30, 2010 6:27 pm Post subject: |
|
|
Hello All--
I have been trying to use the string encryption from this post: http://www.autohotkey.com/forum/topic23719.html&postdays=0&postorder=asc&highlight=aes&start=15
Pretty much I take the encrypted string and write it to an INI file for reading/decryption later. Running tests with the code, however, only allows me to successfully decrypt once.
| Code: | !+F12::
SID := 128 ; 256bit AES
pKey := "n0disassemble"
KeyWait, Alt, L
KeyWait, LShift, L
InputBox, pPassword, Macro Password, Please Specify Windows Password (It will be encrypted):,,300,125
pPassword = %pPassword%
nSize := Text_AES(sTextEncrypt, &pPassword, StrLen(pPassword), pKey, SID, True) ; Encryption
IniWrite, %sTextEncrypt%, macro.ini, User, Password
pPassword = 1234567
InputBox, pPassphrase, Macro Password, Please Specify PassPhrase (It will be encrypted):,,300,125
pPassphrase = %pPassphrase%
nSize := Text_AES(sTextEncrypt, &pPassphrase, StrLen(pPassphrase), pKey, SID, True) ; Encryption
IniWrite, %sTextEncrypt%, macro.ini, User, Passphrase
pPassphrase = 1234567
return
+^F12::
SID := 128 ; 256bit AES
pKey := "n0disassemble"
KeyWait, Control, L
KeyWait, LShift, L
IniRead, pPassword, macro.ini, User, Password, 0
nSize := Text_AES(pWordDecrypt, &pPassword, nSize, pKey, SID, False) ; Decryption
MsgBox % pWordDecrypt
IniRead, pPassphrase, macro.ini, User, Passphrase, 0
nSize := Text_AES(pPhraseDecrypt, &pPassphrase, nSize, pKey, SID, False) ; Decryption
MsgBox % pPhraseDecrypt |
Again this is more proof of concept, once I get it to work properly, I'll clean up the code, move the key definitions, etc.
Text_AES is defined as noted here:
| Code: |
Text_AES(ByRef sResult, pData, nSize, sPassword, SID = 256, bEncrypt = True)
{
VarSetCapacity(sResult, bEncrypt ? nSize+16 : nSize)
DllCall("RtlMoveMemory", "Uint", &sResult, "Uint", pData, "Uint", nSize)
nSize := Crypt_AES(&sResult, nSize, sPassword, SID, bEncrypt)
NumPut(0, sResult, nSize, "char"), VarSetCapacity(sResult,-1)
Return nSize
} |
When I check the encrypted string in the INI file, they look identical but when I decrypt, the first will come out fine...the second will come up as a completely different string.
Any help would be appreciated. |
|
| Back to top |
|
 |
moruls Guest
|
Posted: Wed Jul 20, 2011 8:07 am Post subject: |
|
|
Anyway filehelper can strip our char(13) carriage returns ?
Ideally as an option !! |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|