9 ms·
Actually you can use a cryptographic hash function such as SHA-256 (or MD5, but lets not go there) as the core of a stream cipher. Basically stick a seed (key)
by JoachimS 10y ago
Actually you can use a cryptographic hash function such as SHA-256 (or MD5, but lets not go there) as the core of a stream cipher. Basically stick a seed (key) combined with a counter as input to the hash functiom. Use the output as the keystream. Stream ciphers such as ChaCha are basically block based PRFs that operates like this.
Of course the performance would be silly compared to dedicated functions. ChaCha20 has less than a third the number of iterations compared to SHA-256. And each iteration is much faster.
Good thread:
http://crypto.stackexchange.com/questions/48/is-it-feasible-to-build-a-stream-cipher-from-a-cryptographic-hash-function http://crypto.stackexchange.com/questions/48/is-it-feasible-...