Support Questions

Find answers, ask questions, and share your expertise

How to hash a data field in nifi

avatar
New Contributor

Hi,

I have a QueryDatabaseTable component that extracts thousands of rows from a table. I want to hash one of those values before writing the updated avro or json to hdfs. It looks like the HashContent component hashes the whole content - whereas I only wish to hash one of the values in each row.

How can I do this?

Thanks,

Bryan

3 REPLIES 3

avatar
Rising Star

@Bryan Quinn

Did you check the HashAttribute processor ?

http://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.3.0/org.apache....

It looks like it will do what you are looking for.

Thanks,

Zohar

avatar
New Contributor

@zhoussen

I don't think that helps. I want to be able to apply a sha-256 hash to one of my values.

Any other suggestions? Seems like a common enough use case..

Thanks,

Bryan

avatar
Rising Star

@Bryan Quinn

You are correct. I missed the fact that the processor hashes attributes together rather than apply an sha hash. My bad. It looks like no processor is available to do this today, but NIFI-2961 has been opened to address this given requirement. The suggested alternative would be to do it through ExecuteScript processor. Please check the following thread for further details: http://apache-nifi-users-list.2361937.n4.nabble.com/Encryption-and-Hashing-in-Nifi-td2307.html

Thanks,

Zohar