ChaCha20 ist eine moderne Stromchiffre (Stream Cipher) mit festem 256-Bit-Schlüssel und 96-Bit-Nonce (einmaliger Wert pro Sitzung).
Entwickelt 2008 von Daniel J. Bernstein als AES-Alternative für schwache Hardware optimiert für Software-Implementierungen ohne Spezialanweisungen.
Funktion:
1. Stromchiffre-Prinzip
Klartext + Key-Stream = Chiffretext
Chiffretext + Key-Stream = Klartext (XOR-Operation)
- Generiert pseudozufälligen Key-Stream aus Initial-State (Key + Nonce + Counter).
- 20 Runden Matrix-Operationen (Add, Rotate, XOR = ARX-Konstruktion).
- Keine S-Boxes oder Lookup-Tabellen → constant-time Ausführung.
2. Initial-State-Matrix (4×4)
Seed (8 Bytes) | Counter (8 Bytes)
Key (8 Bytes) | Nonce (8 Bytes)
Jede Runde mischt diese Matrix → 512-Bit Key-Stream pro Block → XOR mit Klartext.
✅ Vorteile:
– Timing-angriffssicher
AES: Tabelle-Zugriffe → Cache-Timing-Angriffe
ChaCha20: Nur CPU-Register + ARX → konstante Laufzeit
– Geschwindigkeit auf Allzweck-CPUs
- ARM Cortex (Smartphones): 2-3x schneller als AES.
- x86 ohne AES-NI: ChaCha20 > AES-CTR.
- Vektorisierbar (AVX2, NEON) für Massendurchsatz.
– Fehlerresistente Implementierung
- Keine geheimen Konstanten (alles öffentlich auditiert).
- Einfache Referenz-Implementierung (< 300 Zeilen C).
- Weniger Side-Channel-Vektoren als AES.
– 96-Bit-Nonce + 64-Bit-Counter
96 Bit Nonce = 7,9×10^28 Werte
64 Bit Counter = 1,8×10^19 Blöcke
→ Praktisch unbegrenzt für TLS-Sessions
🔌 Einsatzbeispiele:
| Protokoll/Plattform | ChaCha20-Mode | Partner-Algorithmus |
|---|---|---|
| TLS 1.3 | ChaCha20-Poly1305 | Google, Cloudflare |
| WireGuard VPN | ChaCha20 | Poly1305 (Auth) |
| Google ATLS | Default | Mobile/Cloud |
| SSH | chacha20-poly1305 | OpenSSH 7.8+ |
| KeePassXC | Optional | Password Manager |
Vergleich AES vs ChaCha20:
ARM-Cortex A53 (no AES-NI):
AES-256-GCM: 450 MB/s
ChaCha20: 1100 MB/s
Intel w/ AES-NI:
AES-256-GCM: 3500 MB/s
ChaCha20: 1200 MB/s
Status: IETF-Standard (RFC 7539), TLS 1.3 obligatorisch, post-quanten-sicher (große Schlüssel).
Ideal für:
- Mobile Geräte (kein AES-Hardware).
- IoT (schwache MCUs).
- Software-VPNs (WireGuard).
- Cloud (gleichmäßige Performance).

