Mohammed H
Mohammed H

Reputation: 7058

aes_decryption don't work in phpmyadmin

I have one table in mysql database:

CREATE TABLE IF NOT EXISTS `t` (
  `q` varchar(257) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

I added two values to it - one is through mysql-console and other from phpmyadmin:

insert into t(q) values(aes_encrypt('from phpmyadmin', 123456));
insert into t(q) values(aes_encrypt('from mysql console', 123456));

And I tried to display it:

select aes_decrypt(q,123456) from t;

From mysql-console I got the following out put:

mysql> select aes_decrypt(q,123456) from t;
+-----------------------+
| aes_decrypt(q,123456) |
+-----------------------+
| from phpmyadmin       |
| from mysql console    |
+-----------------------+
2 rows in set (0.00 sec)

From phpadmin I got the following output: enter image description here

why phpmyadmin don't show correct output?

Upvotes: 4

Views: 4039

Answers (2)

user4881733
user4881733

Reputation: 11

You can try the following query

select aes_decrypt(unhex(q),123456) from t;

Upvotes: 0

Madhura Jayaratne
Madhura Jayaratne

Reputation: 2284

aes_decrypt function produces binary data. Try

select cast(aes_decrypt(q,123456) as char) from t LIMIT 0, 30;

on your phpMyAdmin.

Upvotes: 11

Related Questions