Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (32 sloc) 0.737 kb
from general import *
"""pt: string to encrypt, plaintext
si: shift index"""
def encrypt(pt, si):
res = ""
for char in pt:
if char == " ":
res += " "
continue
res += itoc((ctoi(char)+si)%26)
return res
"""et: encrypted string
si: shift index"""
def decrypt(et, si):
res = ""
for char in et:
if char == " ":
res += " "
res += itoc((ctoi(char)-si)%26)
return res
if __name__ == "__main__":
print "Note: Spaces are just ignored"
print "Enter something to encrypt: "
x = raw_input()
print "Enter shift: "
s = int(raw_input())
print "Encrypted: ", encrypt(x, s)
print "Enter something to decrypt: "
x = raw_input()
print "Enter shift: "
s = int(raw_input())
print "Decrypted: ", decrypt(x, s)
Jump to Line
Something went wrong with that request. Please try again.