Updated on 2024-04-25 GMT+08:00

Generating an MD5 Hash Value

Function Name

$md5(StringA)

Parameter Description

StringA: string to be encoded. The value contains a maximum of 256 bytes and supports the following special characters: !*'();:@&=+$,/?#[]-.~%<>_|{}`^.

Function Description

Converts a string into an MD5 hash value. Parameter A supports the following types:

  • Value in the format listed in Parameter Description
  • Environment parameters
  • Local parameters
  • Other built-in functions

Application Scenarios

The MD5 hash function can be used in the following scenarios for API automation:

  • Request URL
  • Request header
  • Request body
  • Checkpoint property
  • if condition
  • for loop interrupt condition

Example

  • Request URL

    As shown in the following figure, the value of test in the request URL is the MD5 hash value generation function. Parameter A in the function is the string abc123.

  • Request header

    As shown in the following figure, the value of Accept-Encoding in the request header is the MD5 hash value generation function. Parameter A in the function is the string abc123.

  • Request body

    As shown in the following figure, the request body uses the MD5 hash value generation function. Parameter A in the function is $uuid().

  • Checkpoint property

    As shown in the following figure, the target value of the checkpoint property result is the MD5 hash value generation function. Parameter A in the function is the local parameter test. For details about how to set local parameters, see Local Parameters.

  • if condition

    As shown in the following figure, the target value of the if condition is the MD5 hash value generation function. Parameter A in the function is the environment variable status. For details about how to set environment parameters, see Setting Environment Parameters.

  • for loop interrupt condition

    As shown in the following figure, the target value of the for loop interrupt condition is the MD5 hash value generation function. Parameter A in the function is the string abc123.