Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaned up documentation of rot13.rs to match the rest of the documen… #80

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions src/ciphers/rot13.rs
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
//! Rot13 or "rotate by 13 places"
//!
//! # Algorithm

/// Encrypts a given [`&str`] using ROT13 cipher.
/// Encrypts a given [`&str`] using ROT13 cipher or "rotate by 13 places"
///
/// See [ROT13](https://en.wikipedia.org/wiki/ROT13) for more information.
///
/// Replaces each character with the 13th letter after it in the alphabet.
/// Rot13 is a special case of [Caesar cipher](https://en.wikipedia.org/wiki/Caesar_cipher)
/// Rot13 is a special case of a [Caesar cipher](https://en.wikipedia.org/wiki/Caesar_cipher)
///
/// The most basic example is ROT 13, which rotates 'a' to 'n'.
/// This implementation does not rotate unicode characters.
///
/// # Arguments
///
/// `text` - String to transform.
/// * `text` - String to transform.
///
/// # Returns
///
/// An owned [`String`]
///
/// # Panic
///
/// This function won't panic.
/// An owned [`String`] with the transformed text.
///
/// # Examples
/// ```
/// # use rust_algorithms::ciphers::rot13;
/// ```rust
/// use rust_algorithms::ciphers::rot13;
///
/// let encoded = rot13("hello world");
///
/// assert_eq!(encoded, "URYYB JBEYQ");
/// ```
pub fn rot13(text: &str) -> String {
Expand Down
Loading