[ILUG-BOM] Decoding offensive fortune cookies

Philip S Tellis philip@[EMAIL-PROTECTED]
Mon Sep 22 09:42:38 IST 2003


On Sun, 21 Sep 2003, Nikhil Joshi wrote:

> man strfile gave that the alphabets are rotated 13 positions.
                            ^^^^^^^^^
letters.  an alphabet is a collection of symbols used in a grammar.  

The english alphabet has 26 symbols, 
base64 has 64, 
the hexadecimal alphabet consists of 16,
and utf8 has much more.

> so i wrote a program , it now works. Can a shell script be written to
> achieve the same purpose ?

That aside, what you've seen is called ROT13 encryption.  Decryption 
using the shell is fairly simple using tr:

cat file | tr "a-zA-Z" "n-za-mN-ZA-M" > newfile

of course, this isn't portable across character sets.  For that, you'd 
have to list every single character... but I don't feel like doing that 
right now.

-- 
It is not every question that deserves an answer.
		-- Publilius Syrus

-----BEGIN GEEK CODE BLOCK-----
GCS/ED/MU/TW d- s+: a- C+++ UL+++ P++++ L+++>$ E--- W+++ N- o-- K- w---
PS+ PE Y+ PGP+ t* X- R* tv b+ DI+++ D+ G++ e+++>$ h* r y
------END GEEK CODE BLOCK------





More information about the Linuxers mailing list