I was just surfing around in my script-directory and found another gem I scripted back in February. The main purpose was to decrypt a ciphered sentence. Although it would have only taken me a couple of seconds to decrypt it, I decided that it would be even more fun to script it
.
This is the result: shift-cipher
There is also a version available in Ruby: shift-cipher-ruby
This script should work (as usual) on any current GNU/Linux Distribution or *BSD where Perl or Ruby is installed. It deals with one line of standard input, which means that you can simply pipe the output of a command-line tool into it. An example:
ap0calypse@shu:/home/ap0calypse/scripts> echo "x adkt hwxuixcv" | shift-cipher
shift by: 1 : y belu ixyvjydw
shift by: 2 : z cfmv jyzwkzex
shift by: 3 : a dgnw kzaxlafy
shift by: 4 : b ehox labymbgz
shift by: 5 : c fipy mbczncha
shift by: 6 : d gjqz ncdaodib
shift by: 7 : e hkra odebpejc
shift by: 8 : f ilsb pefcqfkd
shift by: 9 : g jmtc qfgdrgle
shift by: 10 : h knud rgheshmf
shift by: 11 : i love shifting
shift by: 12 : j mpwf tijgujoh
shift by: 13 : k nqxg ujkhvkpi
shift by: 14 : l oryh vkliwlqj
shift by: 15 : m pszi wlmjxmrk
shift by: 16 : n qtaj xmnkynsl
shift by: 17 : o rubk ynolzotm
shift by: 18 : p svcl zopmapun
shift by: 19 : q twdm apqnbqvo
shift by: 20 : r uxen bqrocrwp
shift by: 21 : s vyfo crspdsxq
shift by: 22 : t wzgp dstqetyr
shift by: 23 : u xahq eturfuzs
shift by: 24 : v ybir fuvsgvat
shift by: 25 : w zcjs gvwthwbu
As you can see, shifting this sentence by a value of 11 really starts making sense. This is a REALLY bad way to encrypt, but hey, it is still better than nothing.
NOTE: special characters (äöüß) are NOT supported. It works with a-z.










One Comment
really nice
i tried it and it works!
by the way … the link-exchange is running =]