Last active
April 11, 2022 21:24
-
-
Save FreddieOliveira/62b3d05f9086abe520dbd18a8485e4a2 to your computer and use it in GitHub Desktop.
Simple bash script to produce all Ceaser cypher variations (from rot1 to rot25)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# original ideia from here: https://chris-lamb.co.uk/posts/decrypting-caesar-cipher-using-shell | |
# check number of arguments | |
if (( $# != 1 )); then | |
echo "Usage: $0 TEXT" | |
exit -1 | |
fi | |
IN=$1 | |
filling="[@*26]" | |
# see https://unix.stackexchange.com/questions/510838 | |
# for further explanation | |
for i in $(seq 25); do | |
rot="[@*$i]" | |
tr $rot\A-Z$filling\a-z A-ZA-Za-za-z <<< "$i: $IN" | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment