All Products
Search
Document Center

MaxCompute:MD5

Last Updated:Jun 29, 2023

Returns the MD5 value of a string specified by str.

Syntax

string md5(string <str>)

Parameters

str: required. A value of the STRING type. If the input value is of the BIGINT, DOUBLE, DECIMAL, or DATETIME type, the value is implicitly converted into a value of the STRING type before calculation.

Return value

A value of the STRING type is returned. The return value varies based on the following rules:

  • If the value of str is not of the STRING, BIGINT, DOUBLE, DECIMAL, or DATETIME type, an error is returned.

  • If the value of str is null, null is returned.

Examples

  • Example 1: Return the MD5 value of the string Tech on the net. Sample statement:

    -- The return value is ddc4c4796880633333d77a60fcda9af6. 
    select md5('Tech on the net');
  • Example 2: An input parameter is set to null. Sample statement:

    -- The return value is null. 
    select md5(null);

Related functions

MD5 is a string function. For more information about functions related to string searches and conversion, see String functions.