ROT13 In Bash On Linux Code Cipher Example

View previous topic View next topic Go down

ROT13 In Bash On Linux Code Cipher Example

Post by jamied_uk on 1st August 2016, 21:21



Code:
sudo gedit .bashrc



Code:
function rot13 {
if [ -r $1 ]; then cat $1 | tr '[N-ZA-Mn-za-m5-90-4]' '[A-Za-z0-9]'; else echo $* | tr '[N-ZA-Mn-za-m5-90-4]' '[A-Za-z0-9]';
fi
}

alias rot13="tr a-zA-Z n-za-mN-ZA-M"



Example.sh


Code:
#!/bin/bash
# Usage: ./example.sh "uryyb gurer"
echo "$@" | rot13


Code:
./example.sh "uryyb gurer"
avatar
jamied_uk
Admin

Posts : 2191
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: ROT13 In Bash On Linux Code Cipher Example

Post by jamied_uk on 30th April 2017, 22:30

Decryption is easy since 13 is the half way point of the 26 chars in the alphabet, so running this cypher will reveal the plaintext or Decrypted text!
avatar
jamied_uk
Admin

Posts : 2191
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum