| Crates.io | sodiumbox |
| lib.rs | sodiumbox |
| version | 0.1.0 |
| created_at | 2025-05-15 11:10:06.277717+00 |
| updated_at | 2025-05-15 11:10:06.277717+00 |
| description | Pure Rust implementation of libsodium's sealed box encryption |
| homepage | https://github.com/Dstack-TEE/dstack |
| repository | https://github.com/Dstack-TEE/dstack |
| max_upload_size | |
| id | 1674808 |
| size | 25,516 |
A pure Rust implementation of libsodium's sealed box encryption, compatible with libsodium/sodiumoxide but without any C dependencies.
SodiumBox provides a standalone implementation of the sealed box functionality from libsodium (NaCl) using only pure Rust cryptographic libraries. It is designed to be a drop-in replacement for sodiumoxide's sealed box functionality.
The implementation uses modern, well-maintained Rust cryptographic libraries:
x25519-dalek for Curve25519 key exchangexsalsa20poly1305 for authenticated encryptionblake2 for key derivationsalsa20 for the HSalsa20 functionuse sodiumbox::{generate_keypair, seal, open_sealed_box};
// Generate a new keypair
let (public_key, secret_key) = generate_keypair();
// Create a message to encrypt
let message = b"This is a secret message";
// Seal the message for the recipient
let sealed_box = seal(message, &public_key);
// Open a sealed box
let result = open_sealed_box(&sealed_box, &public_key, &secret_key);
match result {
Ok(plaintext) => println!("Decrypted message: {:?}", plaintext),
Err(_) => println!("Failed to decrypt"),
}
This crate is licensed under either of:
at your option.