How to create a hash of any file in java?

How to generate a hash value of a file of any type (.doc, .docx, *. Pdf, etc.) in java?

+5
source share
1 answer

The answer posted the corresponding answer Getting MD5 checksum in Java

You can look at "Real How To" here and use the desired hashing algorithm like this

String myHash = "MD5"; // or "SHA-1" or "SHA-256"
MessageDigest complete = MessageDigest.getInstance(myHash);
+6
source

All Articles