https://github.com/rykerwilder/rot13-encryption
ROT13 encryption script.
https://github.com/rykerwilder/rot13-encryption
decryption encryption encryption-decryption rot13
Last synced: 6 months ago
JSON representation
ROT13 encryption script.
- Host: GitHub
- URL: https://github.com/rykerwilder/rot13-encryption
- Owner: RykerWilder
- Created: 2025-04-01T17:54:23.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-04-01T18:48:47.000Z (7 months ago)
- Last Synced: 2025-04-01T18:50:55.371Z (7 months ago)
- Topics: decryption, encryption, encryption-decryption, rot13
- Language: Python
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ROT13 Encryption
ROT13 ("rotate by 13 places") is a simple letter substitution cipher that replaces a letter with the 13th letter after it in the alphabet.
---
1. **str.maketrans** creates a translation table to replace characters in a string.
2. **The first argument** is the list of original characters: all lowercase followed by all uppercase ('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ').3. **The second argument** is the list of replacement characters:
- For lowercase (string.ascii_lowercase):
string.ascii_lowercase[13:] takes the letters from the 13th position onwards ('nopqrstuvwxyz').
string.ascii_lowercase[:13] takes the first 13 letters ('abcdefghijklm').
Concatenating them gives: 'nopqrstuvwxyzabcdefghijklm' (ROT13 for lowercase).
- For uppercase (string.ascii_uppercase):
Same logic: string.ascii_uppercase[13:] ('NOPQRSTUVWXYZ') + string.ascii_uppercase[:13] ('ABCDEFGHIJKLM') → 'NOPQRSTUVWXYZABCDEFGHIJKLM' (ROT13 for uppercase).---
```python
# Encryption
message = "Hello World!"
encrypted = rot13(message)
print(encrypted) # Output: "Pvnb Zbaqb!"# Decryption (same function)
decrypted = rot13(encrypted)
print(decrypted) # Output: "Hello World!"
```To see how rot13 encryption works see here [ROT13 Encryption](https://github.com/RykerWilder/notes/blob/main/ROT-13.md).