Weird thing with DES

Weird thing with DES

am 04.08.2006 23:27:30 von soup_or_power

I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
I can't seem to encrypt the number 227968199 because I tried several
times and also tried other numbers which work fine.

Here is a sample session:


mysql> create table `destest` (num varchar(17));
Query OK, 0 rows affected (0.04 sec)


mysql> desc destest;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| num | varchar(17) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
1 row in set (0.00 sec)


mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
'sfG3853ncr1pt'));
Query OK, 1 row affected (0.00 sec)


mysql> select * from destest;
+------------------+
| num |
+------------------+
| ÿÿÔ¨=F0!?`f4~±ëk=86 |
+------------------+
1 row in set (0.00 sec)


mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
+-----------------------------------+
| DES_DECRYPT(num, 'sfG3853ncr1pt') |
+-----------------------------------+
| ÿÿÔ¨=F0!?`f4~±ëk=86 |
+-----------------------------------+
1 row in set (0.00 sec)


mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
'sfG3853ncr1pt'));
Query OK, 1 row affected (0.00 sec)


mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;


+-----------------------------------+
| DES_DECRYPT(num, 'sfG3853ncr1pt') |
+-----------------------------------+
| ÿÿÔ¨=F0!?`f4~±ëk=86 |
| 12345678 |
+-----------------------------------+
2 rows in set (0.00 sec)


I have also tried

FLUSH DES_KEY_FILE;=20


It is so weird!=20


Reply =BB