Search

Lib.rs

› Cryptography › Crypto
#aead #nacl #salsa20 #xsalsa20

no-std crypto_secretbox

Pure Rust implementation of the XSalsa20Poly1305 (a.k.a. NaCl crypto_secretbox) authenticated encryption cipher as well as the libsodium variant of XChaCha20Poly1305

Owned by Tony Arcieri, RustCrypto.

  • Install
  • GitHub repo (rustcrypto)
  • API Reference

4 releases (2 breaking)

0.2.0-pre.0 Oct 5, 2025
0.1.1 May 16, 2023
0.1.0 May 16, 2023
0.0.0 Nov 29, 2022

#2892 in Cryptography

Download history 177965/week @ 2025-12-31 398136/week @ 2026-01-07 412785/week @ 2026-01-14 510848/week @ 2026-01-21 462646/week @ 2026-01-28 378435/week @ 2026-02-04 322983/week @ 2026-02-11 395112/week @ 2026-02-18 434044/week @ 2026-02-25 437524/week @ 2026-03-04 395023/week @ 2026-03-11 221150/week @ 2026-03-18 199664/week @ 2026-03-25 190306/week @ 2026-04-01 211464/week @ 2026-04-08 241472/week @ 2026-04-15

884,004 downloads per month
Used in 361 crates (23 directly)

Apache-2.0 OR MIT

17KB
160 lines

RustCrypto: crypto_secretbox

crate Docs Apache2/MIT licensed Rust Version Project Chat Build Status

crypto_secretbox is an authenticated symmetric encryption cipher amenable to fast, constant-time implementations in software, combining either the Salsa20 stream cipher (with XSalsa20 192-bit nonce extension) or ChaCha20 stream cipher with the Poly1305 universal hash function, which acts as a message authentication code.

This algorithm has largely been replaced by the newer IETF variant of ChaCha20Poly1305 (and the associated XChaCha20Poly1305) AEAD ciphers (RFC 8439), but is useful for interoperability with legacy NaCl-based protocols.

Documentation

Security Warning

No security audits of this crate have ever been performed, and it has not been thoroughly assessed to ensure its operation is constant-time on common CPU architectures.

USE AT YOUR OWN RISK!

License

Licensed under either of:

  • Apache License, Version 2.0
  • MIT license

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~1.5MB
~28K SLoC

  • aead =0.6.0-rc.2
  • optional chacha20 =0.10.0-rc.2+zeroize+xchacha+legacy
  • cipher =0.5.0-rc.1
  • hybrid-array+zeroize
  • poly1305 =0.9.0-rc.2
  • default salsa20 =0.11.0-rc.1+zeroize
  • subtle
  • zeroize
  • dev hex-literal 0.4

Other features

  • alloc
  • heapless
  • os_rng
  • rand_core
  • std
Related: poly1305, ssh-cipher, ocb3, ccm, chacha20, aead, cipher, salsa20, eax, aes-siv, chacha20poly1305, aes-gcm-siv, aes-gcm, crypto_box, crypto_kx, crypto_secretstream, crypto-bigint, crypto, crypto-common, crypto-mac
See also: orion, tink-aead, libsodium-sys-stable, dryoc, salty, sodiumoxide

Lib.rs is an unofficial list of Rust/Cargo crates, created by kornelski. It contains data from multiple sources, including heuristics, and manually curated data. Content of this page is not necessarily endorsed by the authors of the crate. This site is not affiliated with nor endorsed by the Rust Project. If something is missing or incorrect, please file a bug.