index | submit | rank | book

rot13 – ROT13 encryption and decryption

ROT13 is an encryption algorithm where each roman letter is replaced by the thirteenth letter coming after it in the alphabet while wrapping around Z to A. The letter A is replaced by N, B is replaced by O, C is replaced by P, …, and Z is replaced by M.

ROT13 Encryption and Decryption represented in a circle

One can perform ROT13 encryption and decryption using the above circle by replacing the letter on the outer circle by the adjacent letter in the inner circle.

The ROT13 algorithm is a symmetrical encryption algorithm, the same process is used to encrypt and decrypt data. It is a weak encryption method.

Write a program that is able to encrypt and decrypt using the ROT13 cypher. While encrypting and decrypting, your program should keep the case of letters and leave other characters unchanged.

Input and output

Input will consist of several lines of text containing ASCII characters. Output should contain the encrypted/decrypted ROT13 text.

Each line of input will contain at most 99 characters. This is for information purposes only, you do not need to check that on your submitted program – just make sure it works within this bound.

Example input

Hello, World!
Guvf vf zl frperg zrffntr.

Example output

Uryyb, Jbeyq!
This is my secret message.


try first: hello

try next: caesar

index | submit | rank | book

Copyright © 2020-2021 Rudy Matela
All rights reserved