HI guys, I want to create and encryption system that converts a character to encrypted data, I'm thinking about using the ord() and chr() functions in python then slice the sting into characters implement the encryption on each character and bring them back together what do you think, Is there anybody who has done such, a project before what are the other things I need to do.

This style of encryption is very weak. If you have patience for interesting, but very long thread we had starting from this vegaseat's snippet, I think you can benefit from this:
Text Encryption/Decryption with XOR (Python)

See especial my devil's advocate posts on braking the encryption:icon_twisted:

Edited 5 Years Ago by pyTony: n/a

Well will check it out, and let you know, thanks for the help, I hope to be great like you someday able to answer, questions concerning stuffs.

Well I will put my mind to it thanks a million, matrix encryption, I will read up on that.

Here is a simple oldie:

'''
example of simple encoding/decoding using rot13
where the alphabet is shifted by 13 positions to
'nopqrstuvwxyzabcdefghijklm'
so 'a' becomes 'n' and so on
(non-alpha characters are not affected)
note: Python2x actually had this built in
'''

# here is a way to implement this in Python3
alpha   = 'abcdefghijklmnopqrstuvwxyz'
alpha13 = 'nopqrstuvwxyzabcdefghijklm'

word = "peanutbutter"
encoded13 = ""
for c in word:
    if c in alpha:
        # use the index
        c = alpha13[alpha.index(c)]
    encoded13 += c

print(word)
print(encoded13)  # crnahgohggre

# decode it (same algorithm)
decoded13 = ""
for c in encoded13:
    if c in alpha:
        c = alpha13[alpha.index(c)]
    decoded13 += c

print(decoded13)  # peanutbutter
Comments
love this.

e-papa this is for u

ENCODER

def e(x):
	file=open("alice.txt",'r')
	text=file.read()
	l=text
	f = open('unreadable.txt', 'w+')
	t=1
	n=1
	#d = [ [t, -x, x+12], [x, -t, n+5], [7, 8, 9] ]
	#m=t*((-9*t)-8(n+15))+x(9*x-7(n+15))+(x+12)(8*x+7*t)
	listmain=['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '[', ']', '\\', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', "'", 'Z', 'X', 'C', 'V', 'B', 'N', 'M', ',', '.', '/', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '{', '}', '|', ':', '"', '<', '>', '?', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm']
	tinylist = [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 51, 52, 53, 54, 56, 57, 58, 59, 55, 1, 2, 3, 4, 5, 6, 7, 8, 9, 71, 72, 73, 74, 75, 76, 78, 79, 99, 91, 92, 93, 94, 95, 96, 97, 98, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90]
	for char in l:
		t=t+1
		#print "t",t
		if char in listmain:
			#print "char",char
			n = tinylist[listmain.index(char)]
			#print "n",n
			m=t+x+n
			s = str(m)
			f.write(s)
			#print "s",s
			f.write(";")
		else:
			n=999
			#print "char",char
			#print "n",n
			m=t+x+n
			s = str(m)
			f.write(s)
			#print "s",s
			f.write(";")
]
DECODER
[
def d(x):
	file=open("unreadable.txt",'rb+')
	text=file.read()
	a=text
	l=a.split(";")
	f = open('readable.txt', 'wb+')
	t=1
	n=1
	k=0
	w=0
	m=0
	#d = [ [t, -x, x+12], [x, -t, n+5], [7, 8, 9] ]
	#m=t*((-9*t)-8(n+15))+x(9*x-7(n+15))+(x+12)(8*x+7*t)
	listmain=['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '[', ']', '\\', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', "'", 'Z', 'X', 'C', 'V', 'B', 'N', 'M', ',', '.', '/', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '{', '}', '|', ':', '"', '<', '>', '?', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm']
	tinylist = [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 51, 52, 53, 54, 56, 57, 58, 59, 55, 1, 2, 3, 4, 5, 6, 7, 8, 9, 71, 72, 73, 74, 75, 76, 78, 79, 99, 91, 92, 93, 94, 95, 96, 97, 98, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90]
	q=len(l)
	del l[q-1]
	for char in l:
		t=t+1
		w=int(l[k])
		c=w/(t*x)
		#print "c",c
		if c in tinylist:
			n = listmain[tinylist.index(c)]
			s = str(n)
			f.write(s)
		else:
			f.write(" ")
		k=k+1

will work on the mathmatical complexity of the encoding and decoding processes tomoroow. could someone tell me how do add a whitespace character to a list.

thanks,
vidur

Edited 5 Years Ago by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

This question has already been answered. Start a new discussion instead.