I am trying to create a crc32 hash of a string in java. I was able to do that with java.util.zip.CRC32. But my requirement is to create the CRC32 hash of a string using a secret key. Can anyone tell me how to do this? Thanks in advance...
My existing code is given below...
String a = "abcdefgh";
CRC32 crc = new CRC32();
crc.update(a.getBytes());
String enc = Long.toHexString(crc.getValue());
System.out.println(enc);
Using a salt ensures the hashed string doesn't have the same hash than with another salt or without salt.
It's usually done with a simple concatenation :
But it's a little surprising here : salting is usually done for security, and CRC32 isn't normally used for cryptography, it's a non secure hash used for redundancy check or indexing keys.