Keyed hashing vs salted hashing
HashingSha256(myText + saltValue)
vs
HMAC(myText, myPrivateKey)
The main difference is that the salt is not assumed unknown to the attacker, but the key is.
An additional difference is that salts are supposed to vary; if you hash three passwords…
Hashing function
HashingHashing is one way, it's irreversible (you cannot "de-hash" a hash to get back the original text).
As opposed to encrypting which is revisable (by decrypting).
A hash function is any function that can be used to map data of arbitrary size…
Consistent hashing
HashingBefore diving into consistent hashing, let's understand the naive approach first.
Naive: Distributed hashtable based on modulo
Sharding can be achieved via a simple modulo shardNumber = hash(key) % TOTAL_SHARDS
The hash function might differ…
Hash Collision
HashingA collision happens when distinct values produce the same hash code.
If you can artificially create a hash collision, that's an issue. Because this means you can inject malicious scripts (see Collision Attack).
Example:
Given Document A and…