AES Encrypt problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

AES Encrypt problem

Post by susrisha »

I am trying to select the AES encryption of a string from mysql

Code: Select all

 
$query= "SELECT AES_ENCRYPT(  'hello', SecretKey ) as mykey
FROM  `aorsdklicense` WHERE devid='developertestdevid'"; 
 
$result= mysql_query($query);
$row = mysql_fetch_assoc($result);
$encstring = $row['mykey'];
 
 
if i directly echo the $encstring, it is giving me unreadable values. So i tried bin2hex function to make them readable.

There is another application which is giving AES encrption of the same string wiht the same secret key. But its unable to produce the same result.
Here is the comparison:
0ce74a52dd982363b1bba19c8b67cca4 =>68936403402915e2f95ce9430640c268

The one on the left is the encryption from my system and the one on the right is from the other system.
Could not make out anything of it. If it triggers anything to anyone.. please let me know :)
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: AES Encrypt problem

Post by susrisha »

:banghead: for a while now.. anyone??
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: AES Encrypt problem

Post by requinix »

MySQL uses 128-bit encryption. What strength is the "other application" using?

(No, you can't pass an argument or something to AES_ENCRYPT to make it use another bit depth.)
Post Reply