Español

Lee este artículo en español.

How to Hash Text in n8n (MD5, SHA-256, SHA-512) for Free

Updated

Short answer: Use the built-in Crypto node. Add it to your flow, choose the action Hash and pick the Type (for example SHA256). You can also use the expression {{ $json.text.hash('sha256') }}. Both are free and you don't need an API for this.

A hash is a short fingerprint of a text or a file. You use it to check that something has not changed, to spot duplicate records, or to shorten long content into a key. n8n can calculate hashes on its own, so you don't need any extra service.

The free way: Crypto node

  1. Add a Crypto node after the node that has your text (for example a trigger or a Set node).
  2. Set the action to Hash.
  3. In Type, choose the algorithm: MD5, SHA256, SHA3-256, SHA3-384, SHA3-512, SHA384 or SHA512.
  4. In Encoding, choose HEX or BASE64.
  5. In Value, write the text to hash, for example {{ $json.content }}.
  6. In Property Name, write hash. The result goes to {{ $json.hash }}.

The node works item by item: each item gets its own hash.

For example, the text hello world with SHA256 and HEX gives b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9.

Note: the Crypto node does not offer SHA-1. If you need SHA-1, use the expression below.

Hashing a file

To hash a file, turn on Binary File and enter the Binary Property Name, which is the name of the field that holds the file.

Example: only process records that changed

  1. A trigger with the record's content.
  2. A Crypto node (action Hash, Type SHA256, Encoding HEX) that computes its hash.
  3. An If node that compares {{ $json.hash }} with the hash saved last time (in a database or Google Sheets). If they are different, the flow continues. If they are the same, it stops.

Only content that actually changed gets reprocessed.

Another free way: the hash() expression

In any field that accepts expressions, you can write:

{{ $json.text.hash('sha256') }}

The function works on a string. If you leave out the algorithm, it uses md5. The algorithms are: md5, base64, sha1, sha224, sha256, sha384, sha512, sha3 and ripemd160. Unlike the Crypto node, it includes SHA-1.

When the Cofferdock API is worth it

If you only need a hash in n8n, the Crypto node is the better option: it is free, built in and needs no key. The API only makes sense when one of the reasons above applies to you.

What you'll get

You send a text and the algorithm you want (md5, sha1, sha256 or sha512) and get back the hash, in hex or base64.

Common uses in n8n:

What you need

Step by step in the HTTP Request node

Add an HTTP Request node and fill it in like this:

{ "text": "={{ $json.content }}", "algorithm": "sha256" }

The response includes hash and algorithm, ready to use with {{ $json.hash }}.

Options you can tweak

Add them in the same JSON body:

OptionDefaultWhat it does
algorithmsha256md5, sha1, sha256 or sha512.
encodinghexhex or base64.

Prefer to see it in code?

The same call with curl:

curl -X POST "https://api.cofferdock.com/hash" \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "hello world", "algorithm": "sha256"}'

How much does it cost?

Each call uses 1 credit from your plan, whatever the algorithm or the size of the text. Every Cofferdock tool draws from the same pool of credits.

FAQ

Does n8n have a native node to generate hashes? Yes. The Crypto node has a Hash action (n8n docs). It is free and needs no account or key. You can also use the hash() expression (n8n docs), for example {{ $json.text.hash('sha256') }}.

Can I hash a file, not just text? Yes. In the Crypto node, turn on Binary File and enter the Binary Property Name. The Cofferdock API also accepts raw binary bytes directly (Content-Type application/octet-stream).

Which algorithm should I use? sha256 for most cases (checksums, deduplication). md5 only if you need compatibility with an old system that requires it.

Does the same text always produce the same hash? Yes, a hash is deterministic: the same text and algorithm always produce the same result.

Related guides

Try it yourself

You'll find the full instructions, with copy-paste examples, on the hash generator page. And if you don't have an account yet, you can create one for free and build your first flow today.