Skip to main content

Crate cast5

Crate cast5 

Source
Expand description

Pure Rust implementation of the CAST5 block cipher (RFC 2144).

§⚠️ Security Warning: Hazmat!

This crate implements only the low-level block cipher function, and is intended for use for implementing higher-level constructions only. It is NOT intended for direct use in applications.

USE AT YOUR OWN RISK!

§Examples

use cast5::cipher::{Array, BlockCipherDecrypt, BlockCipherEncrypt, KeyInit};
use cast5::Cast5;

let key = Array::from([0u8; 16]);
let mut block = Array::from([0u8; 8]);
// Initialize cipher
let cipher = Cast5::new(&key);

let block_copy = block;
// Encrypt block in-place
cipher.encrypt_block(&mut block);
// And decrypt it back
cipher.decrypt_block(&mut block);
assert_eq!(block, block_copy);

Re-exports§

pub use cipher;

Structs§

Cast5
The CAST5 block cipher.