The ChaCha cipher was introduced in Daniel J. Bernstein "ChaCha, a variant of Salsa20". The implementation follows the specification in the IRTF RFC 7539: "ChaCha20 and Poly1305 for IETF Protocols".
Learn the NumPy trick for generating synthetic data that actually behaves like real data.