If I want to save a hash of a certain number of bits, but my hashing algorithm gives me more bits than I need, then what is the safest way to shorten it?
- Just remove the first or last few bits
- XOR the first or last few bits with the part I'm keeping
- Do something else
Does it matter how I'm shortening it, or does it depend on the hash algorithm I'm using? Does this reduce the security of the hash (ex.: is a 128-bit hash trimmed to 64 bits worse than a 64-bit hash of the same algorithm)?