YS_NE
YS_NE

Reputation: 344

Hashes of various types of files

I need to take hashes of various types of files in an archive using java application e.g. office files, jpeg files, xmls etc. I know I can calculate the Hashes using MessageDigest. But is there any recommendation if Hash should be taken for specific type of files only. If I have some large .swf files (flash files), is it ok to take the hash of those too? Also is there a recommended way to organize the hashes. For example if I have a zip file, and have hashes of all the files in zip file, is there a recommended way to organize i.e. tree of hashes. Or the hash of zip file itself if good enough?

Upvotes: 0

Views: 71

Answers (1)

zaph
zaph

Reputation: 112857

If you need a hash that is collision resistant use a Cryptographic hash. If you are trying ti create file identifiers you need a collision resistant hash.

The file type does not make a difference in the selection of a collision resistant hash.

SHA-256 is a good hash candidate for such use.

Upvotes: 1

Related Questions