difference between CRC and HashCode

i was wondering wheather there is a difference between a crc value and a HashCode. the definition of both seems the same.

"if 2 objects are equal the hashcode/must be equal, if the objects differ the crc/hashcode *should* be different to improve performance."

i have another question: how can i calculate a 64 or 128 bit crc? are there classes to do this or have i program this functionality myself?

[418 byte] By [codymanix] at [2007-9-27 22:41:56]
# 1

CRC may be used for calculating the hashcode.

CRC is calculated by a precise algorithm, while the hashcode can be anything that's respecting the definition.

In java, I think, the standard hashcode is simply based on the memory position.

But this is only the standard hashcode, when implementing your own, you might very well use CRC for it.

The CRC is calculated based on the content of the file and a mask.

I dont know a standard way for calculating 64bit CRC in Java, when your going to implement it yourself, search the net for a good mask to use.

phohmeyer at 2007-7-7 13:36:03 > top of Java-index,Other Topics,Algorithms...
# 2
And by the way CRC means "cyclic redundancy check", this may help you know what to search the web for.
DrClap at 2007-7-7 13:36:03 > top of Java-index,Other Topics,Algorithms...
# 3
thanks phohmeyer und DrClap.what classes are there in the jre for calculating CRC's or file Hashing? are there ones with 128 or 64 bits?
codymanix at 2007-7-7 13:36:03 > top of Java-index,Other Topics,Algorithms...
# 4
There's java.util.zip.CRC32. From its name I would suppose it's 32 bits.
DrClap at 2007-7-7 13:36:03 > top of Java-index,Other Topics,Algorithms...
# 5
You can use java.security.MessageDigest to do that.
patrik olsson at 2007-7-7 13:36:03 > top of Java-index,Other Topics,Algorithms...
# 6
hey great man! MessageDigest seems the way to go for me. but i fear that it will be very slow cos there is no fixed hashvalue size. but i'll see. thx again, you got the duke
codymanix at 2007-7-7 13:36:03 > top of Java-index,Other Topics,Algorithms...