pub fn route_cipher_decrypt(
    input: &str,
    key: u128
) -> Result<String, &'static str>
Expand description

Decrypts a string using the route cipher.

§Arguments

  • input - The string to decrypt
  • key - The number of rails used to encrypt the string

§Example

use cryptographic_primitives::route_cipher_decrypt;
 
let ciphertext = String::from("Hl r!eowl l,od ");
let plaintext = route_cipher_decrypt(&ciphertext, 3).unwrap();
 
assert_eq!(plaintext, "Hello, world!");
 

§Errors

  • Input must not be empty - If the input string is empty
  • Key must be greater than 0 - If the key is less than 1
  • Memory access error - If there is an error in setting the characters in the result string