Bug #54684 ENCRYPT() returns binary result
Submitted: 22 Jun 2010 5:09 Modified: 22 Jun 2010 5:18
Reporter: Alexander Barkov Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version:5.5.3, 5.5.5-m3 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Triage: Triaged: D2 (Serious)

[22 Jun 2010 5:09] Alexander Barkov
Description:
Function ENCRYPT() returns a pure ASCII string (precisely, [a–zA–Z0–9./]),
but it's reported as a binary string.

How to repeat:
$mysql --column-type-info test

mysql> select encrypt('a');
Field   1:  `encrypt('a')`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  binary (63)
Length:     13
Max_length: 13
Decimals:   31
Flags:      BINARY 

+---------------+
| encrypt('a')  |
+---------------+
| 6IxbYURxo/7A. |
+---------------+
1 row in set (0.00 sec)

Suggested fix:
Make ENCRYPT() return a character string,
like the other similar encryption function do (e.g. md5).
[22 Jun 2010 5:18] Valeriy Kravchuk
Verified with current mysql-trunk from bzr:

valeriy-kravchuks-macbook-pro:trunk openxs$ bin/mysql -uroot --column-type testReading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.5-m3-debug Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>  select encrypt('a');
Field   1:  `encrypt('a')`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  binary (63)
Length:     13
Max_length: 13
Decimals:   31
Flags:      BINARY 

+---------------+
| encrypt('a')  |
+---------------+
| Tuoxwj30SNot. |
+---------------+
1 row in set (0.00 sec)
[28 Jun 2010 8:22] Tonci Grgin
Probable duplicate in Bug#54856.