Skip to content

Hash

Returns the hash of the given content.

1
$Crypto.Hash(content: string, hashName?: ( "SHA1" | "SHA256" | "SHA384" | "SHA512" )):string

Parameters

string content
    The content to be hashed.

( "SHA1" | "SHA256" | "SHA384" | "SHA512" ) hashName optional
    The name of the hash algorithm to be used. If not specified, SHA1 is used.

Returns

The hash of the given content in Base64 encoding.

Remarks

The content is encoded as UTF-8 before hashing, and the hash is returned as a Base64 string. The default algorithm is SHA1; use SHA256 or a stronger algorithm for new data. SHA1 is weak and must not be used for security purposes.

Examples

Hash a value with SHA256

1
var hashedContent = $Crypto.Hash($Xml.Evaluate('Document/Content'), 'SHA256');