bitwiseshiftleft/sjcl — pull request #144 by stbuehler (2013-12-23 19:33:18+00:00)
Title: (X)Salsa20/r + ChaCha20 (+ChaCha8 + ChaCha12)

Hi,

I'd like to request adding some stream ciphers from the Salsa and ChaCha families; motivation for Salsa20 is already discussed in #141. ChaCha is very similar (read "easy to maintain together with Salsa20"), possibly faster in low-level implementations, hopefully more secure, and there is a recent draft to use it in TLS (see https://tools.ietf.org/id/draft-agl-tls-chacha20poly1305-04.html).

Both stream ciphers have a lot of KAT vectors generated with code from "ECRYPT Stream Cipher Project" (framework + Salsa20 implementation) + ChaCha8 reference implementation from http://cr.yp.to/chacha.html (which was not included in http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/, but uses the framework), modified to generate output for 12 and 20 rounds too; I modified the ecrypt source a little bit to output JavaScript readable data.
The test vectors for ChaCha20 also include the ones from the TLS draft, for XSalsa20 vectors from `cryptopp` are included.

Salsa20 adds 2100 bytes, ChaCha20 1827 bytes (compressed with closure).