Lably
Skip to content

ROT13

Simple encryption method

  • 12 min read
  • 6 chapters

Related on Lably

Through Inverse function, Mathematics and Confidentiality

ROT13 may be referred to as Rotate13, ROT-13, rotate by 13 places, or sometimes by its autonym EBG13.

Description

Applying ROT13 to a piece of text requires examining its alphabetic characters and replacing each one by the letter 13 places further along in the Latin alphabet, wrapping back to the beginning as necessary.

When encoding a message, A becomes N, B becomes O, and so on up to M, which becomes Z. Then the sequence continues at the beginning of the alphabet: N becomes A, O becomes B, and so on to Z, which becomes M. When decoding a message, the same substitution rules are applied, but this time on the ROT13 encrypted text. Other characters, such as numbers, symbols, punctuation or whitespace, are left unchanged.

Because there are 26 letters in the basic Latin alphabet and 26 = 2 × 13, the ROT13 function is its own inverse:

ROT13(ROT13(x))=x for any basic Latin-alphabet text x.

In other words, two successive applications of ROT13 restore the original text (in mathematics, this is sometimes called an involution; in cryptography, a reciprocal cipher).

The transformation can be done using a lookup table, such as the following:

For example, in the following joke, the punchline has been obscured by ROT13:

Why did the chicken cross the road?
Gb trg gb gur bgure fvqr!

Transforming the entire text via ROT13 form, the answer to the joke is revealed:

Jul qvq gur puvpxra pebff gur ebnq?
To get to the other side!

A second application of ROT13 would restore the original.

Sign in to keep reading

5 more chapters are free with a Lably account.

More in Computing and communication