©SQL :: Manager
HomeProgram InformationTechnical detailsFree downloadDonate for a cup of coffee
myway SQL Manager for MySQL and MariaDB, Download on Uptodown
SQL functionMySQLMariaDB

The MD5 SQL Function in MySQL and MariaDB - MD5 128-bit checksum

MD5Syntax:MD5(String)
Return value:CHAR
Function type:Encryption & Compression
Function Description

The MD5() function calculates an MD5 128-bit checksum for "String".

The return value is a 32-hex digit string in the character set and collation of the current connection.

Numeric values ​​as an argument are interpreted as a character string.

If the value of the "String" argument is NULL, the MD5() function returns NULL.


Before MariaDB version 5.5, the return value was a binary string.

SQL Examples for the MD5 function

 1
 2
 3
 4
 5
 6
 7
 8

select md5('test');
select md5(123456);
select char_length(md5('test')),bit_length(unhex(md5('test')));

select md5('');
select md5(null);

md5('test')
varchar(32) BINARY
098f6bcd4621d373cade4e832627b4f6
md5(123456)
varchar(32) BINARY
e10adc3949ba59abbe56e057f20f883e
char_length(md5('test'))
bit_length(unhex(md5('test')))
int(10)bigint(11)
32128
md5('')
varchar(32) BINARY
d41d8cd98f00b204e9800998ecf8427e
md5(null)
varchar(32) BINARY
NULL
The examples were created with the MyWAY SQL manager: Download

How to use the MD5() function in MySQL and MariaDB databases

Both MySQL and MariaDB provide a MD5() function used to calculate the MD5 hash of a string. The function takes a string as input and returns a 32-character string with a hexadecimal representation of the MD5 hash. This hash value is often used for simple hashing purposes, such as storing passwords or verifying the integrity of data. MD5 is considered a rather weak hashing algorithm by today's standards, mainly due to its susceptibility to collisions. For more security, stronger hashing algorithms such as SHA-256 or bcrypt should be used.

The MD5() function is not reversible. Once a string hashed with MD5, it is no longer possible to create the original string from the hash value.
MAKEDATEMAKETIMEMAXMD5MEDIANMICROSECONDMID

Further MySQL und MariaDB SQL Encryption & Compression

AES_DECRYPTAES_DECRYPT(String, Key)
More about AES_DECRYPT Function

AES_ENCRYPTAES_ENCRYPT(String, Key)
More about AES_ENCRYPT Function

COMPRESSCOMPRESS(String)
More about COMPRESS Function

DECODEDECODE(Binary string, Password)
More about DECODE Function

DES_DECRYPTDES_DECRYPT(Binary string [, Key])
More about DES_DECRYPT Function

DES_ENCRYPTDES_ENCRYPT(String [, Key])
More about DES_ENCRYPT Function

ENCODEENCODE(String, Password)
More about ENCODE Function

ENCRYPTENCRYPT(String [, Salt])
More about ENCRYPT Function

FROM_BASE64FROM_BASE64(String)
More about FROM_BASE64 Function

OLD_PASSWORDOLD_PASSWORD(String)
More about OLD_PASSWORD Function

PASSWORDPASSWORD(String)
More about PASSWORD Function

RANDOM_BYTESRANDOM_BYTES(Length)
More about RANDOM_BYTES Function

SHASHA(String)
More about SHA Function

SHA1SHA1(String)
More about SHA1 Function

SHA2SHA2(String, Length)
More about SHA2 Function

TO_BASE64TO_BASE64(String)
More about TO_BASE64 Function

UNCOMPRESSUNCOMPRESS(Binary string)
More about UNCOMPRESS Function

Numeric functionsString functionsRegular ExpressionsDate and Time functions
Comparison functionsEncryption & CompressionConversion functionsNULL functions
Aggregate functionsWindow functionsJSON functionsGeometric functions
Sequence functionsInformation functionsDynamic ColumnsMiscellaneous functions
More information about the MD5 SQL function: mysql.com and mariadb.com
Updated: 2023-09-24ImprintContactTerms & conditionsPrivacy & CookiesUpdatesSitemapFacebookLinkedinTwitterStatistics©2020-2024 Heino Cunze-Fischer