You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
davhojt ad7c443467 docs(cytale_cipher) correct grammar 2 years ago
..
README.md docs(cytale_cipher) correct grammar 2 years ago

README.md

scytale_cipher

Instructions

Create a function which creates a scytale cipher (also known as spartan cipher).

In practice, it is represented by a strip wrapped around a cylinder. The message is written across the loops of the strip (not along the strip). The message becomes coded if the radius of the cylinder changes, or the strip is removed from the cylinder.

Your function should recreate the scytale cipher, so that the String represents the message, and the u32 represents the number of times the strip is wrapped around the cylinder.

Example

size 6: "scytale Code" -> "sec yCtoadle"

--------------------------------
  |s|  |c|  |y|  |t|  |a|  |l|
  |e|  | |  |C|  |o|  |d|  |e|
--------------------------------

size 8: "scytale Code" -> "sCcoydtea l e"

------------------------------------------
  |s|  |c|  |y|  |t|  |a|  |l|  |e|  | |
  |C|  |o|  |d|  |e|  | |  | |  | |  | |
------------------------------------------

Expected Functions

fn scytale_cipher(message: String, i: u32) -> String {
}

Usage

Here is a program to test your function

fn main() {
    println!("\"scytale Code\" size=6 -> {:?}", scytale_cipher(String::from("scytale Code"), 6)));
    println!("\"scytale Code\" size=8 -> {:?}", scytale_cipher(String::from("scytale Code"), 8)));
}

And its output

$ cargo run
"scytale Code" size=6 -> "sec yCtoadle"
"scytale Code" size=8 -> "sCcoydtea l e"
$