Re:Hashing is not encryption
by ris on Sunday January 09, 2022 @07:34AM
(#29862707)
The more classic example is probably Feistel ciphers.
[ Parent
| on HN ]
Re:Hashing is not encryption
by Normal_gaussian on Sunday January 09, 2022 @08:05AM
(#29862861)
Which along with other block ciphers are the surprisingly hard to search solution to the problem of providing a bounded, iterable, id that doesnt leak its position of iteration.
(ie, provide an n character id without duplicates and using the entire space. Useful for ids for image hosting etc.)
Re:Hashing is not encryption
by SAI_Peregrinus on Sunday January 09, 2022 @12:10PM
(#29865170)
Or just CTR mode of a hash function (which is closer to what ChaCha20 does internally, it runs a permutation in CTR mode). H(constant, key, nonce, ctr) gets a keystream block, XOR each keystream block with the corresponding plaintext (to encrypt) or ciphertext (to decrypt) block. The constant is important in ChaCha's case, it keeps the attacker-controlled portion of the block strictly less than half the total block, prevents an all-zero input, and has some asymmetry to help diffusion overall.