digest is an in-build function of Apache JMeter and its type is ‘Calculation’. The digest function generates the encrypted value in the specific hash algorithm with the optional salt and upper case. By the way, JMeter in-build functions are divided into eight categories which are:
- Information
- Input
- Calculation
- Formatting
- Scripting
- Properties
- Variables
- Strings
Syntax: ${__digest()}
Type: Calculation
Purpose: To generate the encrypted value in the specific hash algorithm which are
- MD2
- MD5
- SHA-1
- SHA-224
- SHA-256
- SHA-384
- SHA-512
Input Argument: The digest function has 5 arguments among them 3 are optional:
- Algorithm: Mention the algorithm name to use for encryption purposes. It is a mandatory argument. The list of supported algorithms is as follows:
- MD2
- MD5
- SHA-1
- SHA-224
- SHA-256
- SHA-384
- SHA-512
- String to encode: Specify the string to encode. It is a mandatory argument.
- Salt to add: Specify the format of the output (required) date string.
- Upper Case Value: If you want encoded value in upper case then this argument value will be ‘true’. Default or blank argument will be considered as lower case value.
- Variable Name: Name of the variable in which the target date format value will be saved.
Return Value: This function returns the formatted date value.
Example:
String | Salt | Function | Output |
---|---|---|---|
PerfMatrix | ${__digest(MD2,PerfMatrix,,,)} | a6e8e8b011f2bd9f018308e1505f4bbf | |
PerfMatrix | Test | ${__digest(SHA-1,PerfMatrix,Test,,)} | 65333cf3eef4e115903365f4c64fd04db3dc5514 |
You may be interested:
- Apache JMeter – time Function
- Epoch (Unix) Time to Date/Time through Excel
- Apache JMeter – timeShift Function