Function cryptographic_primitives::route_cipher_encrypt
source · pub fn route_cipher_encrypt(
input: &str,
key: u128
) -> Result<String, &'static str>
Expand description
Encrypts a string using the route cipher.
§Arguments
input
- The string to encryptkey
- The number of rails to use
§Example
use cryptographic_primitives::route_cipher_encrypt;
let plaintext = String::from("Hello, world!");
let ciphertext = route_cipher_encrypt(&plaintext, 3).unwrap();
assert_eq!(ciphertext, "Hl r!eowl l,od ");
§Errors
Input must not be empty
- If the input string is emptyKey must be greater than 0
- If the key is less than 1Memory access error
- If there is an error in setting the characters in the result string