Switch the 64 bit hash implementation from 3DES to DES#5529
Switch the 64 bit hash implementation from 3DES to DES#5529sougou merged 1 commit intovitessio:masterfrom
Conversation
DES, for null (\0 bytes) keys like we use they are the same because 3DES is then just DES in an encrypt-decrypt-encrypt cycle with a 8 byte \0 key. Signed-off-by: Jacques Grove <aquarapid@gmail.com>
|
@aquarapid If we switch the hash implementation, does that not mean that values will hash differently? i.e. is there an upgrade problem where in a previous version "value" hashed to shard 3, and now it hashes to shard 6? |
|
No, the behavior remains unchanged (e.g. the current hash_test.go tests are unchanged), because the values hash exactly the same, viz.: DES and 3DES use the same encrypt/decrypt primitive functions that operates using 8 byte keys. However, 3DES uses 3 of these 8 byte keys, viz.: DES: encrypt(input, key) = output 3DES: encrypt(decrypt(encrypt(input, key1), key2), key3) = output These are obviously equivalent when key == "\0\0\0\0\0\0\0\0" and key1 == key2 == key3 == "\0\0\0\0\0\0\0\0" (as in our case) |
|
Verified that this change is safe: https://en.wikipedia.org/wiki/Triple_DES. |
DES, for null (\0 bytes) keys like we use they are the same
because 3DES is then just DES in an encrypt-decrypt-encrypt
cycle with a 8 byte \0 key.
Signed-off-by: Jacques Grove aquarapid@gmail.com