12-05-2009, 01:03 AM
Code:
#Config
##################
a = '!'
b = '@'
c = '#'
d = '$'
e = '%'
f = '^'
g = '&'
h = '*'
i = '('
j = 'a'
k = 'b'
l = 'c'
m = 'd'
n = 'e'
o = 'f'
p = 'g'
q = 'h'
r = 'i'
s = 'j'
t = 'k'
u = 'l'
v = 'm'
w = 'n'
x = 'o'
y = 'p'
z = 'q'
SPACE = ' '
ZERO = '9'
ONE = '8'
TWO = '7'
THREE = '6'
FOUR = '5'
FIVE = '4'
SIX = '3'
SEVEN = '2'
EIGHT = '1'
NINE = '0'
#Example of adding more symbols part 1
COMMA = '<'
#Scroll down until you see "#Example of adding more symbols part 2"
#End Part 1
######################################
##################
#End Config
def menu():
print "1) Encrypt"
print "2) Decrypt"
qaz = int(raw_input("What do you want to do?: "))
if qaz == 1: encrypt()
elif qaz == 2: decrypt()
def encrypt():
a1 = raw_input("What do you want to encrypt?: ")
lena1 = len(a1)
a2 = -1
List = []
for x in xrange(lena1):
a2 = a2 + 1
if a1[a2:a2+1] == 'a': List.append(a)
if a1[a2:a2+1] == 'b': List.append(b)
if a1[a2:a2+1] == 'c': List.append(c)
if a1[a2:a2+1] == 'd': List.append(d)
if a1[a2:a2+1] == 'e': List.append(e)
if a1[a2:a2+1] == 'f': List.append(f)
if a1[a2:a2+1] == 'g': List.append(g)
if a1[a2:a2+1] == 'h': List.append(h)
if a1[a2:a2+1] == 'i': List.append(i)
if a1[a2:a2+1] == 'j': List.append(j)
if a1[a2:a2+1] == 'k': List.append(k)
if a1[a2:a2+1] == 'l': List.append(l)
if a1[a2:a2+1] == 'm': List.append(m)
if a1[a2:a2+1] == 'n': List.append(n)
if a1[a2:a2+1] == 'o': List.append(o)
if a1[a2:a2+1] == 'p': List.append(p)
if a1[a2:a2+1] == 'q': List.append(q)
if a1[a2:a2+1] == 'r': List.append(r)
if a1[a2:a2+1] == 's': List.append(s)
if a1[a2:a2+1] == 't': List.append(t)
if a1[a2:a2+1] == 'u': List.append(u)
if a1[a2:a2+1] == 'v': List.append(v)
if a1[a2:a2+1] == 'w': List.append(w)
if a1[a2:a2+1] == 'x': List.append(x)
if a1[a2:a2+1] == 'y': List.append(y)
if a1[a2:a2+1] == 'z': List.append(z)
if a1[a2:a2+1] == ' ': List.append(SPACE)
if a1[a2:a2+1] == '0': List.append(ZERO)
if a1[a2:a2+1] == '1': List.append(ONE)
if a1[a2:a2+1] == '2': List.append(TWO)
if a1[a2:a2+1] == '3': List.append(THREE)
if a1[a2:a2+1] == '4': List.append(FOUR)
if a1[a2:a2+1] == '5': List.append(FIVE)
if a1[a2:a2+1] == '6': List.append(SIX)
if a1[a2:a2+1] == '7': List.append(SEVEN)
if a1[a2:a2+1] == '8': List.append(EIGHT)
if a1[a2:a2+1] == '9': List.append(NINE)
#Example of adding more symbols part 2
#if a1[a2:a2+1] == 'x': List.append(y)
#They all follow the same format, just replace x with ,(What the user tpyes) and the y with COMMA(The variable representing <)
if a1[a2:a2+1] == ',': List.append(COMMA)
#End Part 2
#######################################
print "".join(List)
def decrypt():
a1 = raw_input("What do you want to encrypt?: ")
lena1 = len(a1)
a2 = -1
List = []
for x in xrange(lena1):
a2 = a2 + 1
if a1[a2:a2+1] == a: List.append('a')
if a1[a2:a2+1] == b: List.append('b')
if a1[a2:a2+1] == c: List.append('c')
if a1[a2:a2+1] == d: List.append('d')
if a1[a2:a2+1] == e: List.append('e')
if a1[a2:a2+1] == f: List.append('f')
if a1[a2:a2+1] == g: List.append('g')
if a1[a2:a2+1] == h: List.append('h')
if a1[a2:a2+1] == i: List.append('i')
if a1[a2:a2+1] == j: List.append('j')
if a1[a2:a2+1] == k: List.append('k')
if a1[a2:a2+1] == l: List.append('l')
if a1[a2:a2+1] == m: List.append('m')
if a1[a2:a2+1] == n: List.append('n')
if a1[a2:a2+1] == o: List.append('o')
if a1[a2:a2+1] == p: List.append('p')
if a1[a2:a2+1] == q: List.append('q')
if a1[a2:a2+1] == r: List.append('r')
if a1[a2:a2+1] == s: List.append('s')
if a1[a2:a2+1] == t: List.append('t')
if a1[a2:a2+1] == u: List.append('u')
if a1[a2:a2+1] == v: List.append('v')
if a1[a2:a2+1] == w: List.append('w')
if a1[a2:a2+1] == x: List.append('x')
if a1[a2:a2+1] == y: List.append('y')
if a1[a2:a2+1] == z: List.append('z')
if a1[a2:a2+1] == ' ': List.append(' ')
if a1[a2:a2+1] == '0': List.append('0')
if a1[a2:a2+1] == '1': List.append('1')
if a1[a2:a2+1] == '2': List.append('2')
if a1[a2:a2+1] == '3': List.append('3')
if a1[a2:a2+1] == '4': List.append('4')
if a1[a2:a2+1] == '5': List.append('5')
if a1[a2:a2+1] == '6': List.append('6')
if a1[a2:a2+1] == '7': List.append('7')
if a1[a2:a2+1] == '8': List.append('8')
if a1[a2:a2+1] == '9': List.append('9')
#Example of adding more symbols part 1
#if a1[a2:a2+1] == 'x': List.append(y)
#They all follow the same format, just replace x with ,(What the user tpyes) and the y with ,(What x actually is)
if a1[a2:a2+1] == ',': List.append(',')
#End Part 1
#######################################
print "".join(List)
menu()