getMD5
getMD5 Function
getMD5 FunctionThe getMD5 function generates an MD5 hash from a given input string using Node.js’ built-in crypto module. It supports configurable output encodings for flexible use in tracking and transformation scenarios.
Purpose
Use this.getMD5 to:
Create a non-secure hash of a string (e.g., for deduplication, consistent keys)
Generate lightweight identifiers or short checksums
Obfuscate simple input values for non-critical use cases
⚠️ Note: MD5 is considered insecure for cryptographic purposes. Do not use it for hashing sensitive or security-critical data.
Function Definition
Function Name
this.getMD5
Type
function
Available In
Server-Side Variables
Returns
string (the hashed output)
Parameters
input
The string value to hash
string
"secret"
encoding
The output encoding format ("hex", "base64", etc.)
string
"hex"
Supported Encodings
Refer to the Node.js crypto documentation for supported encodings. Common options:
hex(recommended for readable output)base64latin1
Example Usage
async function() {
let x = this.getMD5("secret", "hex");
return x;
}This example returns the MD5 hash of the string "secret" encoded as a hexadecimal string.
Use Cases
Generate consistent hash keys for non-sensitive data
Shorten string representations for logging or external IDs
Create anonymized values when security is not a concern
Notes
Always specify a valid encoding (no default is assumed).
For secure hashing (e.g., SHA-256), use
this.getHashinstead.Output is deterministic: same input and encoding will always return the same result.
Summary
this.getMD5 is a quick and easy way to generate an MD5 hash in JENTIS server-side variables. While not suitable for cryptographic use, it is useful for creating lightweight, repeatable hashes for general-purpose tracking logic.
Last updated
Was this helpful?