Page cover
For the complete documentation index, see llms.txt. This page is also available as Markdown.

TweetNaCl

What is NaCl?

NaCl (Networking and Cryptography Library) is a high-speed cryptographic software library for network communication, encryption, decryption, signatures, and related cryptographic operations.

It was designed to make cryptography safer to use by providing a small set of high-level primitives that reduce the risk of developer mistakes.

  • Created by: Daniel J. Bernstein, Tanja Lange, and Peter Schwabe

  • First released: 2008

  • Language: C, with bindings available in many languages

  • Philosophy: NaCl avoids “easy to misuse” cryptography by offering a minimal set of secure primitives with simple APIs.

What is TweetNaCl?

TweetNaCl is a compact, self-contained reimplementation of NaCl in around 100 tweets worth of code. It was designed for portability, readability, and auditability.

  • Created by: The same core team as NaCl

  • Language: C, with JavaScript and other implementations available

  • Goal: Provide a small, auditable cryptographic library with minimal dependencies

Design Goals

  • Security-first: Cryptographic operations are designed to avoid common implementation mistakes.

  • High assurance: Avoids unsafe low-level APIs and ad hoc encryption patterns.

  • Simplicity: Clear interfaces and minimal options reduce room for error.

  • Performance: Optimized for practical cryptographic operations.

  • Portability: Suitable for use across mobile, browser, embedded, and server environments.

Security Notes

NaCl and TweetNaCl are widely used classical cryptographic libraries.

They are designed to be safer and harder to misuse than many low-level cryptographic APIs, but developers must still handle important security requirements correctly, including:

  • Nonce uniqueness

  • Secret key protection

  • Signature verification failures

  • Secure storage of private material

Note: NaCl and TweetNaCl are classical cryptographic libraries and are not post-quantum secure. In Cryptic, they are used only where appropriate or during hybrid transition phases alongside post-quantum algorithms such as ML-KEM and ML-DSA.

Further Reading

Last updated