PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References
PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References

PostgreSQL MD5() Function



The PostgreSQL MD5() function returns an MD5 128-bit checksum representation of a given string. This function returns a 32 character hexadecimal string as the result.

The MD5() function returns NULL if the string is NULL.

Syntax

MD5(string)

Parameters

string Required. Specify the plaintext string used to generate the MD5 128-bit checksum.

Return Value

Returns the MD5 128-bit checksum representation of a string.

Example:

The example below shows the usage of MD5() function.

SELECT MD5('xyz');
Result: 'd16fb36f0911f878998c136191af705e'

SELECT MD5('password');
Result: '5f4dcc3b5aa765d61d8327deb882cf99'

SELECT MD5('alphacodingskills');
Result: 'de0e02d2e002982195993556f112635c'

SELECT MD5(123);
Result: '202cb962ac59075b964b07152d234b70'

SELECT MD5(NULL);
Result: NULL

❮ PostgreSQL Functions