Cryptography

ChaCha20 text encryption with a key

ChaCha20 Encrypt turns plaintext into ciphertext under a 256-bit key: the cipher expands the key into a keystream with 20 rounds of add, rotate and XOR, and XORs it with the message, using a fresh random nonce each run. The Output box shows one lowercase hex string, a 12-byte nonce followed by the ciphertext, which ChaCha20 Decrypt reads back. It is plain ChaCha20 in the RFC 8439 layout with the block counter starting at 1, and has no authentication tag.

How to use ChaCha20 Encrypt

  1. Open ChaCha20 Encrypt in the Toolbox101 app.
  2. Type the plaintext into the Message box.
  3. Enter the key in the key box: 64 hex characters, or any passphrase, which is hashed with SHA-256 to make the key.
  4. Copy the hex from the Output box. The first 24 characters are the random nonce and the rest is the ciphertext.
  5. Send the hex and the key to the recipient, who pastes both into ChaCha20 Decrypt.

Worked example

ChaCha20 Encrypt gives a different result every time, so yours will differ. This is one run:

Input

hello chacha20

Key

000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f

Output

a014356d2b5bdd30c0a81416fbdcb84fb8733826ffe9d77b68a1

Frequently asked questions

What format does the key box expect?

Either one. Sixty-four hex characters are read directly as the 32-byte key. Anything else, such as a passphrase or a short word, is UTF-8 encoded and hashed with SHA-256 to get 32 bytes. An empty box also works, with the hash of the empty string as the key, which is not secret. Type the identical value into encrypt and decrypt and the round trip works.

Why does encrypting the same message give different output?

Every run draws a fresh random 12-byte nonce, and the output is that nonce followed by the ciphertext. A nonce must never be reused under the same key, because two messages XORed with one keystream leak each other. The nonce is public and rides along in the hex, so decryption needs only the key.

Does ChaCha20 detect tampering?

No. Plain ChaCha20 is only a cipher: changing bits of the ciphertext changes the same bits of the plaintext and nothing notices. ChaCha20-Poly1305 adds an authentication tag, which this tool does not produce. If integrity matters, use an authenticated mode in code you control.

What is the difference between ChaCha20 and AES?

AES is a block cipher built on S-box substitution, usually run in GCM or CBC mode, with dedicated hardware instructions on modern CPUs. ChaCha20 is a stream cipher built from additions, rotations and XORs, so it runs fast in software on chips without AES acceleration, which is why TLS 1.3 offers both. Each takes a 256-bit key.

How can I check the ciphertext is right?

Decrypt it. Paste the hex from the Output box into ChaCha20 Decrypt with the same key; if the original message comes back, the round trip is consistent. Only the nonce changes between runs, so every correct encryption of one message under one key is interchangeable.

Use ChaCha20 Encrypt now

Runs in your browser. Nothing you type is uploaded.