ArticleslgStudy

science

ChaCha20-Poly1305

ChaCha20-Poly1305 is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand ChaCha20-Poly1305 rather than just read about it. In short: ChaCha20-Poly1305 is an authenticated encryption with associated data (AEAD) algorithm, that combines the ChaCha20 stream cipher with the Poly1305 message authentication code. It has fast software performance, and, without hardware acceleration, is usually faster than AES-GCM.

ChaCha20-Poly1305 — main illustration
ChaCha20-Poly1305 — illustration

Key takeaways

  • ChaCha20-Poly1305 belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect ChaCha20-Poly1305 to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of ChaCha20-Poly1305 from memory before moving on to harder problems.

Reference excerpt

ChaCha20-Poly1305 is an authenticated encryption with associated data (AEAD) algorithm, that combines the ChaCha20 stream cipher with the Poly1305 message authentication code. It has fast software performance, and, without hardware acceleration, is usually faster than AES-GCM.

History The two building blocks of the construction, the algorithms Poly1305 and ChaCha20, were both independently designed, in 2005 and 2008, by Daniel J. Bernstein. In March 2013, a proposal was made to the IETF TLS working group to include Salsa20, a winner of the eSTREAM competition to replace the aging RC4-based ciphersuites. A discussion followed in the IETF TLS mailing list with various enhancement suggestions, including using Chacha20 instead of Salsa20 and using a universal hashing based MAC for performance. The outcome of this process was the adoption of Adam Langley's proposal for a variant of the original ChaCha20 algorithm (using 32-bit counter and 96-bit nonce) and a variant of the original Poly1305 (authenticating 2 strings) being combined in an IETF draft to be used in TLS and DTLS, and chosen, for security and performance reasons, as a newly supported cipher. Shortly after the IETF's adoption of ChaCha20 and Poly1305 for TLS, the combined AEAD mode was added to OpenSSH via thechacha20-poly1305@openssh.com authenticated encryption cipher but kept the original 64-bit counter and 64-bit nonce for the ChaCha20 algorithm. In 2015, the AEAD algorithm was standardized in RFC 7539 and in RFC 7634 to be used in IPsec. The same year, it was integrated by Cloudflare as an alternative ciphersuite. In 2016 RFC 7905 describes how to use it in the TLS 1.2 and DTLS 1.2 protocols. In June 2018, RFC 7539 was updated and replaced by RFC 8439.

Description The ChaCha20-Poly1305 algorithm takes as input a 256-bit key and a 96-bit nonce to encrypt a plaintext, with a ciphertext expansion of 128-bits (the tag size). In the ChaCha20-Poly1305 construction, ChaCha20 is used to derive a key stream that is XORed with the plaintext. The ciphertext and the associated data is then authenticated using a variant of Poly1305 that first encodes the two strings into one. The way that a cipher and a one time authenticator are combined is precisely identical to AES-GCM construction in how the first block is used to seed the authenticator and how the ciphertext is then authenticated with a 16-byte tag. The main external difference with ChaCha20 is its 64 byte (512 bit) block size, in comparison to 16 bytes (128 bit) with both AES-128 and AES-256. The larger block size enables higher performance on modern CPUs and allows for larger streams before the 32 bit counter overflows.

Variants

XChaCha20-Poly1305 – extended nonce variant The XChaCha20-Poly1305 construction is an extended 192-bit nonce variant of the ChaCha20-Poly1305 construction, using XChaCha20 instead of ChaCha20. When choosing nonces at random, the XChaCha20-Poly1305 construction allows for better security than the original construction. The draft attempt to standardize the construction expired in July 2020.

Salsa20-Poly1305 and XSalsa20-Poly1305 Salsa20-Poly1305 and XSalsa20-Poly1305 are variants of the ChaCha20-Poly1305 and XChaCha20-Poly1305 algorithms, using Salsa20 and XSalsa20 in place of ChaCha20 and XChaCha20. They are implemented in NaCl and libsodium but not standardized. The variants using ChaCha are preferred in practice as they provide better diffusion per round than Salsa.

Reduced-round variants ChaCha20 can be replaced with its reduced-round variants ChaCha12 and ChaCha8, yielding ChaCha12-Poly1305 and ChaCha8-Poly1305. The same modification can be applied to XChaCha20-Poly1305. These are implemented by the RustCrypto team and not standardized.

Use ChaCha20-Poly1305 is used in IPsec, SSH, TLS 1.2, DTLS 1.2, TLS 1.3, WireGuard, S/MIME 4.0, OTRv4 and multiple other protocols and implemented in OpenSSL and libsodium. Additionally, the algorithm is used in the backup software Borg in order to provide standard data encryption and in the copy-on-write filesystem Bcachefs for the purpose of optional whole filesystem encryption. It's also one of the encryption traffic methods of V2Ray.

Performance ChaCha20-Poly1305 usually offers better performance than the more prevalent AES-GCM algorithm, except on systems where the CPU(s) have the AES-NI instruction set extension. As a result, ChaCha20-Poly1305 is sometimes preferred over AES-GCM due to its similar levels of security and in certain use cases involving mobile devices, which mostly use ARM-based CPUs. Because ChaCha20-Poly1305 has less overhead than AES-GCM, ChaCha20-Poly1305 on mobile devices may consume less power than AES-GCM.

Security The ChaCha20-Poly1305 construction is generally secure in the standard model and the ideal permutation model, for the single- and multi-user setting. However, similarly to GCM, the security relies on choosing a unique nonce for every message encrypted. Compared to AES-GCM, implementations of ChaCha20-Poly1305 are less vulnerable to timing attacks. To be noted, when the SSH protocol uses ChaCha20-Poly1305 as underlying primitive, it is vulnerable to the Terrapin attack.

See also Authenticated encryption Galois/Counter Mode Salsa20 Poly1305 Advanced Encryption Standard

External links Josefsson, Simon (2013-03-17). "Salsa20 stream cipher in TLS". mailarchive.ietf.org. IETF. Retrieved 2024-07-31. FYI, we have published -00 of a draft that describes how the Salsa20 stream cipher

References

Worked examples

Example 1 — a first encounter with ChaCha20-Poly1305

Start with the simplest possible case. Write down what ChaCha20-Poly1305 claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to ChaCha20-Poly1305 before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about ChaCha20-Poly1305 ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of ChaCha20-Poly1305

In research
ChaCha20-Poly1305 appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses ChaCha20-Poly1305 in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
ChaCha20-Poly1305 is common in secondary-school and first-year university syllabi. It links to neighbouring topics Authenticated-encryption schemes, Finite fields, Message authentication codes, so understanding it makes those chapters shorter.
In everyday life
Look for ChaCha20-Poly1305 outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “ChaCha20-Poly1305” →

How to study ChaCha20-Poly1305 in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what ChaCha20-Poly1305 means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain ChaCha20-Poly1305 out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is ChaCha20-Poly1305 in simple terms?

ChaCha20-Poly1305 is an authenticated encryption with associated data (AEAD) algorithm, that combines the ChaCha20 stream cipher with the Poly1305 message authentication code. It has fast software performance, and, without hardware acceleration, is usually faster than AES-GCM.

Why does ChaCha20-Poly1305 matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study ChaCha20-Poly1305?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on ChaCha20-Poly1305.

Tags

  • Authenticated-encryption schemes
  • Finite fields
  • Message authentication codes
  • Stream ciphers

Keep exploring