pub fn feistel_network_decrypt(
input: &[u8],
key: &u128,
rounds: u32
) -> Result<Vec<u8>, &'static str>
Expand description
Decrypts an array of bytes using the feistel cipher
§Arguments
input
- The array of bytes to decryptkey
- The key to use for decryptionrounds
- The number of rounds to use for decryption
§Example
use cryptographic_primitives::{feistel_network_encrypt, feistel_network_decrypt};
let plaintext = b"Hello, world!";
let ciphertext = feistel_network_encrypt(plaintext, &15, 5).unwrap();
let decrypted = feistel_network_decrypt(&ciphertext, &15, 5).unwrap();
assert_eq!(decrypted, plaintext.to_vec());
§Errors
Input must not be empty
- If the input array is emptyNumber of rounds must be greater than 0
- If the number of rounds is less than 1HMAC creation failed
- If there is an error in creating the HMAC for the round function or the Key Derivation Function