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.

## All 10 Replies

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:

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.

if you're just starting, you could also learn by doing the matrix encryption

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

This snippet is also about topic, but maybe first best just do it simply.

Thanks will check it out.

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``````
commented: love this. +1

Wow love this.

i will post a fairly basic encryption code soon

commented: Dont bump old threads! +13

e-papa this is for u

ENCODER

``````def e(x):
file=open("alice.txt",'r')
l=text
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):
a=text
l=a.split(";")
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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.