This page runs the ChaCha20 stream cipher from RFC 8439: a 32-byte key, a 12-byte nonce, and a 32-bit block counter. Encryption starts at counter 1. Ciphertext has the same length as the plaintext. The page does not add a Poly1305 tag, so a changed ciphertext still decrypts. Keys and messages stay in memory for this page. They are not written to the URL, browser storage, or analytics.
Parameters
The counter is a 32-bit unsigned integer. RFC 8439 starts encryption at 1. Counter 0 is the block ChaCha20-Poly1305 uses to derive its one-time key. Each block covers 64 bytes, and the counter must not wrap.
Keystream
- First block
- This run
Public sample
Recompute this vector with Node.js crypto.createCipheriv("chacha20", key, iv). The iv is 16 bytes: a 4-byte little-endian counter followed by the 12-byte nonce. OpenSSL EVP_chacha20 and Go golang.org/x/crypto/chacha20 use the same layout. The plaintext below is UTF-8, 114 bytes. Section 2.3.2 gives the first 64-byte keystream block for the same key, nonce, and counter.
- Source
- RFC 8439 §2.4.2
- Key
- HEX, 32 bytes
- Nonce
- HEX, 12 bytes
- Counter
- 1
- Plaintext
- UTF-8, 114 bytes
- Ciphertext
- 114 bytes, HEX or Base64
- First keystream block
- RFC 8439 §2.3.2, 64 bytes
Plaintext
Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.
Key and nonce
000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f 000000090000004a00000000
First keystream block
10f1e7e4d13b5915500fdd1fa32071c4c7d1f4c733c068030422aa9ac3d46c4ed2826446079faa0914c2d705d98b02a2b5129cd1de164eb9cbd083e8a2503c4e
Ciphertext HEX and Base64
5c90838db44879743e6bfd58c64e05a8a2bc91a913af0e23704acfbaa0b80d3da1a20b2027b893302ee29e63f9c222c1da67f0b5fe7928dfaea2a391cd251c2164e4fa5756b9da6e8ca5dc908c44cbf6e93ea6b4cc406988d7da69bf795bf19b84539df73bd9b3e9ca4d03bc0a586ff528dc XJCDjbRIeXQ+a/1Yxk4FqKK8kakTrw4jcErPuqC4DT2hogsgJ7iTMC7inmP5wiLB2mfwtf55KN+uoqORzSUcIWTk+ldWudpujKXckIxEy/bpPqa0zEBpiNfaab95W/GbhFOd9zvZs+nKTQO8Clhv9Sjc