National Cyber Warfare Foundation (NCWF)

Intermediate Cryptography: In the Crypto Wars, ChaCha20 is your new weapon of choice.


0 user ratings
2025-07-02 16:46:14
milo
Red Team (CNA)

Welcome back, my aspiring cyberwarriors! Cryptography, the hiding of data, is one of the fundamental skills of cybersecurity. Without cryptography, all of our data would be exposed in all of our communications and data storage. Cryptography is used to store our passwords (hashing), exchange symmetric keys (asymmetric cryptography), and encrypt our data streams (TLS) and […]


The post Intermediate Cryptography: In the Crypto Wars, ChaCha20 is your new weapon of choice. first appeared on Hackers Arise.



Welcome back, my aspiring cyberwarriors!





Cryptography, the hiding of data, is one of the fundamental skills of cybersecurity. Without cryptography, all of our data would be exposed in all of our communications and data storage. Cryptography is used to store our passwords (hashing), exchange symmetric keys (asymmetric cryptography), and encrypt our data streams (TLS) and data storage. To be functional in our discipline of cybersecurity, you must understand the basics of cryptography but the more you know, the farther and faster you will advance.









In recent years, new symmetric cipher has begun to gain traction in the world of cybersecurity. Most symmetric ciphers are block ciphers, meaning they encrypt a block (bytes of data) of data at time. This works great for data storage but is less than ideal for streaming data. As a result, ChaCha20 is becoming increasingly popular when data streams be secure and fast.









Let’s take a look at ChaCha20!





What Is ChaCha20?





ChaCha20 is a symmetric stream cipher—meaning it encrypts and decrypts data using the same 256-bit key. Designed by Daniel J. Bernstein in 2008, it’s the spiritual successor to Salsa20, with improved diffusion and resistance to cryptanalysis. ChaCha20 is built for speed, security, and simplicity, making it a favorite for everything from VPNs (like WireGuard) to TLS 1.3 and mobile apps.





How Does ChaCha20 Work?





Forget block ciphers like AES. ChaCha20 encrypts data as a continuous stream. Here’s the blueprint of how ChaCha20 works:






  1. Key Generation:

    • Start with a user-supplied 256-bit key and a randomly generated 96-bit nonce (number used once)






  2. Initialization:

    • The cipher’s internal state is set up using the key, nonce, and a 32-bit block counter.




    • This state is a 4×4 matrix of 32-bit words:

      • First row: Constant string (“expand 32-byte k”)




      • Next two rows: The 256-bit key




      • Last row: 32-bit counter + 96-bit nonce.








  3. Keystream Generation:

    • ChaCha20 generates a 512-bit (64-byte) block of pseudo-random keystream for each iteration.




    • Each block is unique—thanks to the counter incrementing every round.






  4. Encryption:

    • The plaintext is XORed with the keystream to produce ciphertext.




    • Decryption is the same process: XOR the ciphertext with the same keystream.






  5. Output:

    • The result is a stream of encrypted data, with no patterns for attackers to exploit.







Why Cybersecurity Experts Love it!






  • Speed: Highly parallelizable, blazing fast even on low-power devices (like phones and IoT gadgets)




  • Security: Resistant to known attacks (differential, linear cryptanalysis), and avoids timing attacks because it doesn’t use lookup tables.




  • Simplicity: No complex S-boxes or hardware dependencies—easy to audit and implement.




  • Flexible: Works in counter mode, so it can encrypt arbitrary-length data streams.





ChaCha20 vs. AES





FeatureChaCha20AES
TypeStream cipherBlock cipher
Key Size256 bits128/192/256 bits
Block Size512 bits (keystream block)128 bits
Hardware NeedNo special hardware requiredAES-NI for best performance
SpeedFast on any CPU, great for mobileFast with hardware support
SecurityStrong, no known practical breaksStrong, but some side-channel risks




Real-World Usage






  • TLS 1.3: One of only two symmetric ciphers recommended (the other is AES-GCM).




  • WireGuard VPN: Uses ChaCha20-Poly1305 for fast, secure tunnels.




  • Mobile Apps: Preferred on ARM devices due to speed and lack of hardware acceleration needs.




  • Google Chrome & Major Browsers: Support ChaCha20-Poly1305 for HTTPS traffic.




  • Some Ransomware





ChaCha20-Poly1305: Authenticated Encryption





ChaCha20 is often paired with Poly1305, a message authentication code (MAC), to create ChaCha20-Poly1305—an AEAD (Authenticated Encryption with Associated Data) cipher.






  • Encryption: ChaCha20 encrypts the data.




  • Authentication: Poly1305 generates a tag to ensure integrity—no silent tampering.





Variants and Extensions






  • XChaCha20: Uses a longer, 192-bit nonce for even better security in random nonce scenarios




  • Reduced-round versions: ChaCha12, ChaCha8 for even faster (but less secure) encryption





Why ChaCha20 Matters





ChaCha20 is the cipher for the modern cybersecurity professionals;






  • No hardware backdoors (many encryption algorithms have backdoors for national intelligence agencies)




  • No timing attacks.




  • No slowdowns on mobile.




  • No excuses for weak crypto.













Summary





ChaCha20 is a secure streaming cipher that is gaining traction throughout the cybersecurity world. Its speed and security is making it a favorite algorithm where speed and security are paramount importance. In addition, it is more lightweight than AES and other encryption algorithms that require or are enhanced by hardware accelerators.









In the crypto wars, ChaCha20 is your new weapon of choice.





To learn more about cryptography, see our course “Cryptography Basics for Hackers” and our upcoming course, “Intermediate Cryptography”.

The post Intermediate Cryptography: In the Crypto Wars, ChaCha20 is your new weapon of choice. first appeared on Hackers Arise.



Source: HackersArise
Source Link: https://hackers-arise.com/intermediate-cryptography-in-the-crypto-wars-chacha20-is-your-new-weapon-of-choice/


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2025 - National Cyber Warfare Foundation - All rights reserved worldwide.