Collections:
MD5() - Calculating MD5 Hash
How to calculate a hash value of a byte string using the MD5() function?
✍: FYIcenter.com
MD5(str) is a MySQL built-in function that
calculates a hash value of a given byte string using the MD5 (Message Digest 5) algorithm.
It always returns a 32 hexadecimal digits string presenting a 128-bit (16-byte) hash value.
For example:
SELECT MD5('FYI'), LENGTH(MD5('FYI')) AS Chars,
LENGTH(UNHEX(MD5('FYI'))) AS Bytes;
-- +----------------------------------+-------+-------+
-- | MD5('FYI') | Chars | Bytes |
-- +----------------------------------+-------+-------+
-- | 89a0ec69fae5a63c6724cc9b146971a0 | 32 | 16 |
-- +----------------------------------+-------+-------+
SELECT MD5('FYIcenter.com'), LENGTH(MD5('FYIcenter.com')) AS Chars,
LENGTH(UNHEX(MD5('FYIcenter.com'))) AS Bytes;
-- +----------------------------------+-------+-------+
-- | MD5('FYIcenter.com') | Chars | Bytes |
-- +----------------------------------+-------+-------+
-- | a742082a673f5d14258342a033173b2f | 32 | 16 |
-- +----------------------------------+-------+-------+
Reference information of the MD5() function:
MD5(str): hash Calculates a hash value of a given byte string using the MD5 algorithm. Arguments, return value and availability: str: Required. The byte string to be processed. hash: Return value. The MD5 hash value in hexadecimal digits Available since MySQL 4.1.
⇒ RANDOM_BYTES() - Generating Random Bytes
⇐ CRC32() - Cyclic Redundancy Check 32-Bit
2023-12-15, 1030🔥, 0💬
Popular Posts:
How To Generate Random Numbers with the RAND() Function in SQL Server Transact-SQL? Random numbers a...
Is SQL Server Transact-SQL case sensitive? No. Transact-SQL is not case sensitive. Like the standard...
How To Use GO Command in "sqlcmd" in SQL Server? "sqlcmd" is a command line client application to ru...
How To Get the Definition of a User Defined Function Back in SQL Server Transact-SQL? If you want ge...
How To Get a List of All Tables with "sys.tables" View in SQL Server? If you want to see the table y...