Docly Developers
Function Updated 17 Oct 2026

sha256(text)

Returns the SHA-256 hash of the text as 64 upper-case hexadecimal characters. The text is encoded as UTF-8, numbers are converted the JavaScript way ("18.2"), and null or undefined is hashed as empty text.

A plain SHA-256 hash is not suitable for storing passwords — use a salted, slow hash such as PBKDF2 (crypto.subtle.deriveBits).

Parameters

textstringrequired

Text to create hash for.

Returns

Upper-case hexadecimal string. null if not called with exactly one argument.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
    let x = "test";
    write(docly.sha256(x));
}#