Struct botan::FPE[][src]

pub struct FPE { /* fields omitted */ }

Represents an instance of format preserving encryption

Examples

use std::str::FromStr;
let modulus = botan::MPI::from_str("1000000000").unwrap();
let key = vec![0; 32];
let rounds = 16;
let compat_mode = false;
let fpe = botan::FPE::new_fe1(&modulus, &key, rounds, compat_mode).unwrap();
let input = botan::MPI::from_str("9392024").unwrap();
let tweak = vec![1,2,3,4,5];
let ctext = fpe.encrypt(&input, &tweak).unwrap();
assert!(ctext < modulus);
let ptext = fpe.decrypt(&ctext, &tweak).unwrap();
assert_eq!(ptext, input);

Methods

impl FPE
[src]

Create a new FPE instance, FE1 scheme Rounds should be 16 or higher for best security

Encrypt value under the FPE scheme using provided tweak

Decrypt value under the FPE scheme using provided tweak

Trait Implementations

impl Debug for FPE
[src]

Formats the value using the given formatter. Read more

impl Drop for FPE
[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl !Send for FPE

impl !Sync for FPE