This is a Noir implementation of ChaCha20 as defined by RFC7539.
Important
This implementation works on 4-byte words, as opposed to the RFC working with 1-byte words.
Due to the above, the tests provided are adopted to 4-byte words
The crates/chacha20_example
provides a small binary implementation to measure circuit size.
+------------------+------------------------+--------------+----------------------+
| Package | Language | ACIR Opcodes | Backend Circuit Size |
+------------------+------------------------+--------------+----------------------+
| chacha20_example | PLONKCSat { width: 3 } | 23969 | 34201 |
+------------------+------------------------+--------------+----------------------+
On a Ryzen 7 7700X, proving a single 32-byte message encryption took 42s
.