I am able to encrypt and decrypt the value fine but the encrypted value is not format-preserving.
When I try to convert the encrypted value to BigUInt using the below code, it returns None.
let num_enc = BigUint::parse_bytes(&ns_encrypted.to_bytes_le(),10).unwrap();
#[test]
fn fpe_ff1_test() {
let bytes = b"123456789";
let ns = BinaryNumeralString::from_bytes_le(bytes);
let num = BigUint::parse_bytes(&ns.to_bytes_le(),10).unwrap();
println!("num:{:?}, ns_to_le:{:?}", num, ns.to_bytes_le());
let fpe_ff = FF1::<Aes256>::new(&[0; 32], 2).unwrap();
let ns_encrypted = fpe_ff.encrypt(&[], &ns).unwrap();
println!("ns_encrypted_to_le:{:?}", ns_encrypted.to_bytes_le());
//UNCOMMENT to reproduce the error
//let num_enc = BigUint::parse_bytes(&ns_encrypted.to_bytes_le(),10).unwrap();
//println!("num_enc_1:{}", num_enc);
let ns_decrypted = fpe_ff.decrypt(&[], &ns_encrypted).unwrap();
println!("ns_decrypted_to_le:{:?}", ns_decrypted.to_bytes_le());
assert_eq!(bytes.to_vec(), ns_decrypted.to_bytes_le());
let num_decrypted = BigUint::parse_bytes(&ns_decrypted.to_bytes_le(),10).unwrap();
println!("num_decrypted:{}", num_decrypted);
assert_eq!(num, num_decrypted);
let num_enc_1 = BigUint::from_bytes_le(&ns_encrypted.to_bytes_le());
println!("num_enc_1:{}", num_enc_1);
let num_decrypted_1= BigUint::from_bytes_le(&ns_decrypted.to_bytes_le());
println!("num_decrypted_1:{}", num_decrypted_1);
}