Reputation: 11
I have a file and calculate the hash of the content but it never matches the same calculation in Java or using online tools to compare. I added 'debug' level processor logging, but it doesn't help.
Per
Upvotes: 0
Views: 564
Reputation: 14184
The process you have described and the example values you've provided should work. I've replicated your flow and I get the expected output (2ff...
) in NiFi for the calculated SHA-256 hash of your static input string.
I've attached a template of my flow. Please import this to your instance of NiFi and run it to compare the results. If you get an incorrect value from this flow, there is something seriously wrong with your NiFi instance. If you get the correct value, I believe a configuration issue in the original flow is to blame.
Update I was able to replicate your output if there was a trailing newline character on the input you provided. You need to trim the input, or include a newline when calculating the hash with a different mechanism.
abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno\n
-> 69ebd9e994e5207d8e8b17b83e081b6f6da47afef2259b7c222e32d4f6d87fe8
abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno
-> 2ff100b36c386c65a1afc462ad53e25479bec9498ed00aa5a04de584bc25301b
Upvotes: 1