PostgreSQL md5() Function

The PostgreSQL md5() function computes the md5 hash of a specified string and returns the result in hexadecimal form.

md5() Syntax

This is the syntax of the PostgreSQL md5() function:

md5(str)

Parameters

str

Required. A string.

Return value

The PostgreSQL md5() function computes the md5 hash of a specified string and returns the result in hexadecimal form.

If the parameter is NULL, the function will return NULL.

md5() Examples

This example shows how to use the md5() function to generate an MD5 hash of Hello World.

SELECT md5('Hello World') AS "md5('Hello World')";
        md5('Hello World')
----------------------------------
 b10a8db164e0754105b7a99be72e3fe5