getSHA256
Last updated
Was this helpful?
getSHA256 FunctionThe getSHA256 function generates a SHA-256 hash from a given input string using Node.js’ built-in crypto module. It supports configurable encoding formats for output customization.
Use this.getSHA256 to:
Generate secure, one-way hashes of input values
Anonymize sensitive data such as user IDs, IPs, or email addresses
Create consistent, tamper-proof identifiers across systems
Function Name
this.getSHA256
Type
function
Available In
Server-Side Variables
Returns
string (SHA-256 hash of the input)
input
The input string to hash
string
"secret"
encoding
Output format of the hash (e.g., "hex", "base64")
string
"hex"
See the Node.js crypto documentation for full details.
Common options include:
hex — Standard readable format (recommended)
base64 — Compact and URL-safe
latin1 — Raw binary encoding
In this example, the SHA-256 hash of the string "secret" is returned in hexadecimal format.
Anonymize personal data before storage or processing
Create secure fingerprints for tracking without revealing raw input
Validate content integrity across systems
SHA-256 is cryptographically secure and suitable for compliance-focused use cases (e.g. GDPR pseudonymization).
Always explicitly provide the desired encoding.
For custom algorithms or flexibility, consider using this.getHash.
this.getSHA256 is a secure and reliable way to hash data in JENTIS server-side variables. It’s the preferred function for anonymizing identifiers or generating hashed tokens when privacy and integrity matter.
Last updated
Was this helpful?
Was this helpful?
async function() {
let x = this.getSHA256("secret", "hex");
return x;
}