> For the complete documentation index, see [llms.txt](https://0xss0rz.gitbook.io/0xss0rz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0xss0rz.gitbook.io/0xss0rz/ctf/cryptography-1/rot-13.md).

# ROT-13 / Caesar

Caesar Cipher

## Python

```
bandit11@bandit:~$ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import codecs
>>> codecs.decode("Gur cnffjbeq vf 5Gr8L4qetPEsPk8htqjhRK8XSP6x2RHh", "rot_13")
u'The password is passwordBandit12'
```

## Online

{% embed url="<https://cryptii.com/pipes/rot13-decoder>" %}

{% embed url="<https://cryptii.com/pipes/caesar-cipher>" %}

## Script

```
# coding=utf-8

# caesar cipher 2 - picoCTF2018
# Inspiré de: https://www.tutorialspoint.com/cryptography_with_python/cryptography_with_python_caesar_cipher

message = 'PICO#4&[C!ESA2?#I0H%R3?JU34?A2%N4?S%C5R%]' #encrypted message

characters = list(map(chr, range(32,126)))
LETTERS = ''.join(characters)

for key in range(len(LETTERS)):
   translated = ''
   for symbol in message:
      if symbol in LETTERS:
         num = LETTERS.find(symbol)
         num = num - key
         if num < 0:
            num = num + len(LETTERS)
         translated = translated + LETTERS[num]
      else:
         translated = translated + symbol
   print('key #%s: %s' % (key, translated))
```

## Sources

{% embed url="<https://0xss0rz.github.io/2019-08-22-OverTheWire-Bandit-2-Write-Ups/>" %}

{% embed url="<https://0xss0rz.github.io/2019-08-22-picoCTF-Cryptography-Write-Ups/>" %}
