/
hash

hash


Function: hash()

Returns hash-encrypted string, optionally with a salt.

Syntax

hash(algorithm, salt, string, format)

ArgumentTypeDescription

algorithm

String

Defines one of the following hashing algorithms to use:

  • SHA-256
  • SHA-384
  • SHA-512
  • SHA-1
  • MD2
  • MD5

salt

String

Additional salt characters to add to the end of the string before hashing.
If no salt is required, specify _NULL.

string

String

The string to be hashed. Must not be null.

formatString

Can have the values of:

  • HEX - output hex-encoded string of the binary data
  • BASE64 - base64 encoded string of the binary data
  • URL - url safe version of the base64 encoded string of the binary data
  • JWT - url safe encoding without padding of the base64 encoded string of the binary data
  • MIME - mime version of the base64 encoded string of the binary data

Examples

hash("SHA-256", _NULL, "testValue")

Takes the string testValue, uses SHA-256 algorithm to convert it to a hashed string. No salt is added. Returns the value: 82fe0c834cbea069013c5eb7828e599a693e0d2411887e2ab273271662973082


Additional Information

The hash function from version 10.1 onwards supports passing the values of secret keys (see Secret Key and Local Secret) into the hash value.

See Also

Related content

Functions
Functions
Read with this
hash
hash
More like this
base64Encode
base64Encode
More like this
base64Decode
base64Decode
More like this
base64Decode
base64Decode
More like this
base64Decode
base64Decode
More like this