2 releases

0.5.2 Apr 26, 2023
0.5.1 Jan 13, 2022

#1523 in Cryptography

Download history 1412/week @ 2024-07-20 284/week @ 2024-07-27 533/week @ 2024-08-03 338/week @ 2024-08-10 705/week @ 2024-08-17 668/week @ 2024-08-24 596/week @ 2024-08-31 943/week @ 2024-09-07 2213/week @ 2024-09-14 1053/week @ 2024-09-21 1397/week @ 2024-09-28 1185/week @ 2024-10-05 445/week @ 2024-10-12 305/week @ 2024-10-19 669/week @ 2024-10-26 612/week @ 2024-11-02

2,292 downloads per month
Used in 2 crates (via cloudproof_fpe)

MIT/Apache

51KB
1K SLoC

fpe Crates.io

This crate contains pure-Rust implementations of format-preserving encryption algorithms.

The following algorithms are implemented:

This crate requires Rust version 1.56 or greater.

License

Licensed under either of

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.


lib.rs:

Format-preserving encryption algorithms.

Example

extern crate aes;
extern crate fpe;

use aes::Aes256;
use fpe::ff1::{BinaryNumeralString, FF1};

let key = [0; 32];
let radix = 2;
let pt = [0xab, 0xcd, 0xef];

let ff = FF1::<Aes256>::new(&key, radix).unwrap();
let ct = ff.encrypt(&[], &BinaryNumeralString::from_bytes_le(&pt)).unwrap();
assert_eq!(ct.to_bytes_le(), [0x75, 0xfb, 0x62]);

let p2 = ff.decrypt(&[], &ct).unwrap();
assert_eq!(p2.to_bytes_le(), pt);

Dependencies

~1MB
~20K SLoC