Expand description
A fast session-data cipher for Rust.
Designed specifically for encrypting non-critical session data such as user IDs and usernames. Uses a keyed substitution cipher with rotating lookup tables seeded via ChaCha20, and HMAC-SHA256 for data integrity verification.
Not intended as a general-purpose cryptographic library. Not suitable for sensitive data such as passwords or financial information.
§Example
use encipher::Encipher;
let step = 7; // controls the substitution offset (1..=255)
let cipher = Encipher::new(Some(42), None, step).unwrap();
let token = cipher.encrypt("{\"id\":1,\"username\":\"shaya\"}");
let decoded = cipher.decrypt(&token).unwrap();
assert_eq!(decoded, "{\"id\":1,\"username\":\"shaya\"}");Structs§
- Encipher
- A session-data cipher instance.