I'm trying to explore some encryption types in python. Could anyone provide me with some beginner encryption code? Thanks for any help. I've already tried changing the length of the message, but that didn't work. Please help!
Asked
Active
Viewed 1,170 times
0
-
1Look here : http://stackoverflow.com/a/12525165/2629998. – Jan 16 '14 at 22:09
-
https://www.dlitz.net/software/pycrypto/ – Vahid Kharazi Jan 16 '14 at 22:10
2 Answers
3
Hacking Ciphers is a great resource! Here is some example code.
import sys
import cmd
message = cmd.raw_input("Enter something to encypt: ")
translated = ''
for i in range(len(message)):
translated = translated + message[i]
i = i - 1
print(translated)
Good luck!

Torkoal
- 457
- 5
- 17
1
x="hello world".encode("rot-13")
print x
print x.decode("rot-13")

Joran Beasley
- 110,522
- 12
- 160
- 179
-
Hi, I added parentheses to the print (i'm using python 3.3) and i got this error message: Traceback (most recent call last): File "C:/Python33/encryptiontest.py", line 1, in
x="hello world".encode("rot-13") TypeError: encoder did not return a bytes object (type=str) >>> – Matthew Mellea Jan 16 '14 at 22:24 -
you didnt specify that this was python 3 ... yeah it works differently there ... – Joran Beasley Jan 16 '14 at 22:26
-
see this answer for python3 http://stackoverflow.com/a/10576397/541038 – Joran Beasley Jan 16 '14 at 22:26
-
Isn't this for string encoding (like going from utf to ascii) not encryption? – wnnmaw Jan 16 '14 at 22:36
-