Bug #61196 MD5 HEX UNHEX
| Submitted: | 17 May 2011 10:21 | Modified: | 17 May 2011 11:39 |
|---|---|---|---|
| Reporter: | ttt ttt | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
| Version: | 5.0.51, 5.0.91, 5.1.56 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | MD5 HEX UNHEX | ||
[17 May 2011 11:39]
Valeriy Kravchuk
Verified just as described with 5.0.91 and 5.1.56 on Windows XP also:
C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -uroot -proot -P3310 test
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 31
Server version: 5.1.56-community MySQL Community Server (GPL)
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 HEX(UNHEX(md5('111'))) as `first`, md5('111') as `second`;
+----------------------------------+----------------------------------+
| first | second |
+----------------------------------+----------------------------------+
| 698D51A19D8A121CE581499D7B701668 | 698d51a19d8a121ce581499d7b701668 |
+----------------------------------+----------------------------------+
1 row in set (0.03 sec)
mysql> SELECT UNHEX(HEX(md5('111'))) as `first`, md5('111') as `second`;
+----------------------------------+----------------------------------+
| first | second |
+----------------------------------+----------------------------------+
| 698d51a19d8a121ce581499d7b701668 | 698d51a19d8a121ce581499d7b701668 |
+----------------------------------+----------------------------------+
1 row in set (0.00 sec)
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: MD5(str) The value is returned as a string of 32 hex digits UNHEX() For a string argument str, UNHEX(str) performs the inverse operation of HEX(str). That is, it interprets each pair of characters in the argument as a hexadecimal number and converts it to the character represented by the number. The return value is a binary string. HEX(str) For a string argument str, HEX() returns a hexadecimal string representation of str where each character in str is converted to two hexadecimal digits. How to repeat: SELECT HEX(UNHEX(md5('111'))) as `first`, md5('111') as `second` must be equals but first second 698D51A19D8A121CE581499D7B701668 698d51a19d8a121ce581499d7b701668 SELECT UNHEX(HEX(md5('111'))) as `first`, md5('111') as `second` first second 698d51a19d8a121ce581499d7b701668 698d51a19d8a121ce581499d7b701668 is OK Suggested fix: UPPER() OR LOWER()