IronFlowDocs

hash

Compute a cryptographic hash of a string or context value.

Parameters

algorithmstringdefault "sha256"
Hash algorithm to use (see Supported Algorithms)
inputstring*
Literal string to hash; supports ${ctx.key} interpolation
source_keystring*
Context key whose value will be hashed
output_keystringdefault "hash"
Context key under which the hex-encoded hash is stored

*Exactly one of input or source_key must be provided. If input is set, it is used (with context interpolation). Otherwise, the value is read from the context key specified by source_key. String context values are used directly; non-string values are JSON-serialized before hashing.

Supported Algorithms

ValueAlgorithm
sha256, sha-256SHA-256
sha384, sha-384SHA-384
sha512, sha-512SHA-512
md5MD5

Algorithm matching is case-insensitive.

Context Output

  • {output_key} -- hex-encoded hash string
  • {output_key}_algorithm -- the algorithm name as provided in the config

Example

local flow = Flow.new("hash_email")

flow:step("hash_it", nodes.hash({
    input = "${ctx.user.email}",
    algorithm = "sha256",
    output_key = "email_hash"
}))

flow:step("done", nodes.log({
    message = "Email hash: ${ctx.email_hash}"
})):depends_on("hash_it")

return flow

Using source_key instead:

local flow = Flow.new("hash_password")

flow:step("hash_pw", nodes.hash({
    source_key = "password",
    algorithm = "sha512"
}))

flow:step("done", nodes.log({
    message = "Password SHA-512: ${ctx.hash}"
})):depends_on("hash_pw")

return flow

The output will be stored in the default key hash with the hex-encoded SHA-512 digest.

IronFlow documentation

Find the next step

Type a keyword to search the documentation.

to move · Enter to open · Esc to close