Created
June 9, 2014 06:10
-
-
Save inaz2/9a1abd63abbf1807058b to your computer and use it in GitHub Desktop.
perform rot0 -- 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
$ echo -n 'hello world' | python rot.py | |
hello world | |
ifmmp xpsme | |
jgnnq yqtnf | |
khoor zruog | |
lipps asvph | |
mjqqt btwqi | |
nkrru cuxrj | |
olssv dvysk | |
pmttw ewztl | |
qnuux fxaum | |
rovvy gybvn | |
spwwz hzcwo | |
tqxxa iadxp | |
uryyb jbeyq | |
vszzc kcfzr | |
wtaad ldgas | |
xubbe mehbt | |
yvccf nficu | |
zwddg ogjdv | |
axeeh phkew | |
byffi qilfx | |
czggj rjmgy | |
dahhk sknhz | |
ebiil tloia | |
fcjjm umpjb | |
gdkkn vnqkc |
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
import sys | |
def rot(s, n): | |
s = bytearray(s) | |
for i, c in enumerate(s): | |
if 0x41 <= c <= 0x5a: | |
s[i] = ((c-0x41+n) % 0x1a) + 0x41 | |
elif 0x61 <= c <= 0x7a: | |
s[i] = ((c-0x61+n) % 0x1a) + 0x61 | |
return s | |
data = sys.stdin.read() | |
for n in xrange(26): | |
print rot(data, n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment