AutoHotkey Community

It is currently May 25th, 2012, 4:49 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: September 26th, 2007, 6:46 pm 
Offline

Joined: June 4th, 2005, 1:30 am
Posts: 113
Location: Stuttgart, Germany
Thanks, Sean!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 1st, 2007, 6:51 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2008, 8:34 pm 
Offline

Joined: January 5th, 2008, 1:56 am
Posts: 2
Location: syracuse,ny
majkinetor wrote:
Quote:

Sad to know you have grown up. My deepest symphaties. :cry:


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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 5:00 am 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1933
Location: Germany
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 March 10th, 2010, 12:43 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2010, 1:20 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Your usage is wrong.
Code:
Crypt_Hash(&V, L, "MD5")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2010, 9:32 am 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1933
Location: Germany
Ok, sorry for this Sean. I make a notice to that posting, not to fooling others.

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2010, 7:27 pm 
Hello All--

I have been trying to use the string encryption from this post: http://www.autohotkey.com/forum/topic23 ... s&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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2011, 9:07 am 
Anyway filehelper can strip our char(13) carriage returns ?

Ideally as an option !!


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon, Jaaaaaaaaay, Rajat, XX0 and 17 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group