File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /// Applies the ROT13 cipher to the given text.
2+ ///
3+ /// ROT13 is a simple letter substitution cipher that replaces a letter with the 13th letter after it in the alphabet.
4+ /// The cipher wraps around, so 'Z' becomes 'M' and 'z' becomes 'm'.
5+ /// Non-alphabetic characters are left unchanged.
6+ ///
7+ /// # Arguments
8+ ///
9+ /// * `text` - The text to be encrypted using ROT13 cipher.
10+ ///
11+ /// # Returns
12+ ///
13+ /// The encrypted text.
14+ ///
15+ /// # Example
16+ ///
17+ /// ```rust
18+ /// use rust_algorithms::ciphers::another_rot13;
19+ ///
20+ /// let text = "ABCzyx";
21+ /// let encrypted = another_rot13(text);
22+ ///
23+ /// assert_eq!(encrypted, "NOPmlk");
24+ /// ```
25+ ///
126pub fn another_rot13 ( text : & str ) -> String {
227 let input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ;
328 let output = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm" ;
You can’t perform that action at this time.
0 commit comments