> For the complete documentation index, see [llms.txt](https://cajac.gitbook.io/ctf-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cajac.gitbook.io/ctf-notes/crypto/substitution-ciphers/caesar-cipher.md).

# Caesar cipher

In [cryptography](https://en.wikipedia.org/wiki/Cryptography), a **Caesar cipher**, also known as Caesar's cipher, the shift cipher, Caesar's code, or Caesar shift, is one of the simplest and most widely known [encryption](https://en.wikipedia.org/wiki/Encryption) techniques. It is a type of [substitution cipher](https://en.wikipedia.org/wiki/Substitution_cipher) in which each letter in the [plaintext](https://en.wikipedia.org/wiki/Plaintext) is replaced by a letter some fixed number of positions down the [alphabet](https://en.wikipedia.org/wiki/Alphabet).

## Decode in bash

### Caesar tool

The `caesar` utility attempts to decrypt caesar ciphers using English letter frequency statistics. `caesar` reads from the standard input and writes to the standard output.

The tool is included in the `bsdgames` package.

Without any arguments

```bash
┌──(kali㉿kali)-[~]
└─$ echo 'WkhTxlfnEurzqIrAMxpsvRyhuWkhOdCBGrj' | caesar                                
TheQuickBrownFoXJumpsOverTheLaZYDog
```

By specifying the number of rotations

```bash
┌──(kali㉿kali)-[~]
└─$ echo 'WkhTxlfnEurzqIrAMxpsvRyhuWkhOdCBGrj' | caesar 23
TheQuickBrownFoXJumpsOverTheLaZYDog
```

## Online services

The following online services can be used to decode caesar ciphers:

Cryptii - Caesar cipher: <https://cryptii.com/pipes/caesar-cipher>

CrypTool-Online - Caesar/ROT13: <https://www.cryptool.org/en/cto/caesar/>

CyberChef - ROT13: <https://gchq.github.io/CyberChef/#recipe=ROT13(true,true,false,3)>

## Resources

caesar - Linux manpage: <https://manpages.debian.org/stretch/bsdgames/caesar.6.en.html>

Caesar cipher - Wikipedia: <https://en.wikipedia.org/wiki/Caesar_cipher>
