How to hash an image?

Hi all,

I have been struggling with this for quite some time now and was hoping somebody can help me out here.

I know how to hash a string, but how do I hash an image? Below the workflow, that obv doesnt work.

Thanks in advance!

You can use the expression:

{{$input.item.binary.data.data}}

The first data is the name of the binary property and the second data is to access the “data”. Important to mention that it will probably not work if binary data mode “filesystem” is set.

2 Likes

Thank you for your answer @jan !
It does indeed not work, does that mean “binary data mode” is set as “filesystem”? And how would I change that?
Thanks!

I’ve found this resource: Scaling binary data in n8n | n8n Docs

As I am using the cloud version, I assume mine is not set to “filesystem”?

Hi @jan , it works, to a certain level haha.
I was testing it in the wrong instance without realising this (with older version), my newer instance did work.
However, I get a different hash from the workflow than hashing the file directly.

Through SHA256 File Checksum Online
hash: 5776cd87617eacec3bc00ebcf530d1924026033eda852f706c1a675a98915826

but through workflow: 2ba27a66c5edf1639fd794816eaa0bff28e0eb68b3bfbb5e3e5c7a761598d671

Thanks in advance!

1 Like

@bees8 Thanks for starting this thread.
We’ve added support for hash and hmac operations with binary data in this PR.
This will most likely be included in the next release.

4 Likes

Wow! That’s amazing, thank you so much!! @netroy

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

New version [email protected] got released which includes the GitHub PR 6359.

3 Likes