Open In App

PostgreSQL – MD5 Function

Last Updated : 01 Feb, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The PostgreSQL MD5() function is used to evaluate the MD5 hash of a string and subsequently return the result. The result is generally in hexadecimal form.

Syntax: MD5(string)

Let’s analyze the above syntax:

  • The string argument is the string of which the MD5 hash is calculated.
  • The MD5() function is used to return a string in TEXT data type form.

Example 1:

The following statement shows the use of the MD5() function to return the MD5 hash of the message ‘GeeksForGeeks MD5’:

SELECT MD5('GeeksForGeeks MD5');

Output:

Example 2:

The following statement shows the use of the MD5() function to return the MD5 hash of the message ‘This is going to be converted into hexadecimal form ‘:

SELECT MD5('This is going to be converted into hexadecimal form');

Output:


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads