| Crates.io | ocb3 |
| lib.rs | ocb3 |
| version | 0.2.0-rc.2 |
| created_at | 2021-05-05 16:12:52.832763+00 |
| updated_at | 2025-11-05 20:27:03.660411+00 |
| description | Pure Rust implementation of the Offset Codebook Mode v3 (OCB3) Authenticated Encryption with Associated Data (AEAD) Cipher as described in RFC7253 |
| homepage | |
| repository | https://github.com/RustCrypto/AEADs |
| max_upload_size | |
| id | 393476 |
| size | 53,780 |
Pure Rust implementation of the Offset Codebook Mode v3 (OCB3) Authenticated Encryption with Associated Data (AEAD) cipher as described in RFC7253.
use aes::Aes128;
use ocb3::{
aead::{Aead, AeadCore, KeyInit, array::Array},
consts::U12,
Ocb3,
};
type Aes128Ocb3 = Ocb3<Aes128, U12>;
let key = Aes128::generate_key().expect("key generation failure");
let cipher = Aes128Ocb3::new(&key);
let nonce = Aes128Ocb3::generate_nonce().expect("nonce failure");
let ciphertext = cipher.encrypt(&nonce, b"plaintext message".as_ref()).unwrap();
let plaintext = cipher.decrypt(&nonce, ciphertext.as_ref()).unwrap();
assert_eq!(&plaintext, b"plaintext message");
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!
Licensed under either of:
at your option.
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.