encryption - MySQL AES_DECRYPT wrong/strange result -


under development machine wamp, aes_encrypt , aes_decrypt not working required, tested encode , decode , same happen... i'm not understading why...

select  aes_encrypt('text', sha1('my secret passphrase')) enc,  aes_decrypt(aes_encrypt('text', sha1('my secret passphrase')), sha1('my secret passphrase')) denc 

result:

enc : 3278167d9d630327c74d83067964c9b6
denc: 74657874

text after encryption doesn't , decryption wrong too.

any suggestions?

it working on side blob data seeing.

denc: 74 65 78 74

74=t 65=e 78=x 74=t, add them 'text'

ascii table here: http://www.asciitable.com/

try cast make more obvious:

select cast(aes_encrypt('text', sha1('my secret passphrase')) char(100)) enc,  cast(aes_decrypt(aes_encrypt('text', sha1('my secret passphrase')), sha1('my secret passphrase')) char(100)) denc 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -