I need a 64-bit hash for strings, and the default .GetHashCode() returns only a 32-bit int. I could generate a MD5/SHA1 hash, and use only the first 64bits. But because those algorithms are cryptographically secure, they are much more demanding on the CPU.
Could it be so simple as to just calling .GetHashCode() a second time, on the reverse of the input string? And casting the two 32bit int into a 64-bit long? Would it have the same spread and collision resistance as a 'real' 64bit hash like CRC64?
You are about to make a very big mistake. A 64-bit hash isn't nearly good enough to guarantee uniqueness. That requires at least 128 bits. A guid is a common choice.
Generating unique 32-bit or 64-bit numbers isn't that hard, you simple use the next one. The rub is that you need to know the previous one. Dbase engines never have a problem with that, their point of being is remembering stuff.
Use an auto-increment column.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With