AutoHotkey Community

It is currently May 27th, 2012, 1:07 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: May 3rd, 2008, 6:16 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
I've found a piece of python code, and tried to translate it into ahk. But in the decryption part, I've got some problems...

Here is the Python code:
Code:
        key = unhexlify('7B35193D966FC3182F6F84F3252239EB4C320D3600000000')
        cipher = AES.new(key, AES.MODE_ECB)
        iv = unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF')
        iv = cipher.encrypt(iv)
        aes_obj = AES.new(key, AES.MODE_CFB,iv)

        decStr = aes_obj.decrypt(encStr)


Ok, the key is hardcoded. The Function unhexlify() is the pendant to hex2str. (I've written this function):
Code:
;************hex2str*************
hex2str(hex){
stelle := 1   
Loop, parse, hex
{

   if (stelle = 1){
      tmphex_item := "0x" . a_loopfield
      stelle = 2
   }else if (stelle = 2){
      tmphex_item .= a_loopfield
      resultstr .= chr(tmphex_item)
      stelle = 1
   }
}
return, resultstr
}

OK. Easy.
But, then... I don't understand this AES encryption :(

1. How can I implement the AES encryptin in AHK? I've only found file encryptions for AES in the forum.

2. For what stands the "iv" variable? It contains 32 F's...after the hex2str() procedure this are 16 "ΓΏ" - looks like a cypher-block :?

Hope somebody can help :D

Regards
IsNull

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 19th, 2008, 5:16 pm 
Offline

Joined: May 17th, 2008, 5:00 am
Posts: 39
Location: Dallas, TX
1. I haven't seen a native implementation of AES in AHK, which I'm a little surprised by since it's pretty simple to port. So your out of luck for an easy answer. An excellent guide for doing so can be found here. (It doesn't cover CFB mode though).

2. "iv" stands for Initialization Vector. It provides a bit of extra protection against rainbow table attacks. Think of it as fixed suppliment to the key.

Cheers,
Shawn


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 19th, 2008, 5:22 pm 
Offline

Joined: March 11th, 2008, 11:36 pm
Posts: 291
probably you're missing this

_________________
Easy WinAPI - Dive into Windows API World
Benchmark your AutoHotkey skills at PlayAHK.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 19th, 2008, 11:05 pm 
Offline

Joined: May 17th, 2008, 5:00 am
Posts: 39
Location: Dallas, TX
heresy wrote:
probably you're missing this

You're missing this...

IsNull wrote:
1. How can I implement the AES encryptin in AHK? I've only found file encryptions for AES in the forum.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 19th, 2008, 11:57 pm 
greynite wrote:
heresy wrote:
probably you're missing this

You're missing this...

IsNull wrote:
1. How can I implement the AES encryptin in AHK? I've only found file encryptions for AES in the forum.

No. You can encrypt any binary data invoking directly Crypt_AES().


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2008, 9:14 am 
Offline

Joined: May 17th, 2008, 5:00 am
Posts: 39
Location: Dallas, TX
Anonymous wrote:
No. You can encrypt any binary data invoking directly Crypt_AES().

Interestingly enough, someone just posted an example over in that thread of doing just that.

Cheers,
Shawn


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2008, 12:23 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
Hey you guys :D ,

I just see this post yet, thanks a lot.

I think ....
Code:
#define CRYPT_MODE_ECB          2       // Electronic code book

... will work.

juppy 8)

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Amandaville, Bing [Bot], BrandonHotkey, chaosad and 22 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