4 ms·
The hashing algorithm can be deterministic however hashing relies on a seed. In most cases you want that to be random to prevent certain side channel attacks. F
by bbatha 8y ago
The hashing algorithm can be deterministic however hashing relies on a seed. In most cases you want that to be random to prevent certain side channel attacks. For swift, hashing will be deterministic for the lifetime of the program.
- selljamhere 8y agoThat makes sense. I was thinking in terms of global lookup keys, which would require hashes to persist across runs. When thinking in terms of object equality, the hashes need only live as long as the objects themselves. Namely, for the lifetime of the program.
- samueloph 8y agowait, hashing relies on a seed?! isn't that a salt/pepper? to be "deterministic for the lifetime of the program" sounds like a pepper is being applied, not that the hash algorithm is different.
- bbatha 8y agoThis is a more accurate description. The hashing algorithm is 100% deterministic, but the inputs include a random seed from the start of the program to prevent various side channel attacks and to prevent folks from erroneously relying on hashmap ordering.