pub fn rail_fence_cipher_decrypt(
input: &str,
key: u128
) -> Result<String, &'static str>
Expand description
Decrypts a string using the rail fence cipher.
§Arguments
input
- The string to decryptkey
- The number of rails used to encrypt the string
§Example
use cryptographic_primitives::rail_fence_cipher_decrypt;
let ciphertext = String::from("H !e,wdloollr");
let plaintext = rail_fence_cipher_decrypt(&ciphertext, 4).unwrap();
assert_eq!(plaintext, "Hello, world!");
§Errors
Input must not be empty
- If the input string is emptyKey must be greater than 0
- If the key is less than 1Error in fence creation
- If there is an error in the fence creation