I have a NoSQL key-value database. I want to insert couple million of records to it.
For the key generation, I'm, using a prefix (something like data-one-
) and then concat the SHA-256 hash of something unique to the value stored. So the end key might look like
data-one-0000fdb60e164cf0bf07cef647354d26ed17c9492ca4bbf4114878325871fa1d
The problem is that the key is somewhat large and it will have impact of the DB performance. I want to chop off some of the hash to get a 64-bit string (so, 8 chars). So I'd chop the above key to
data-one-0000fdb6
But will it leave enough entropy for the remaining key? The DB will get large, and I don't want collisions, obviously. Will another hash be more suitable for this use, or is trimming SHA-256 fine?