Skip to content

Commit

Permalink
print() is a function in Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored Jul 2, 2018
1 parent d4b4b7b commit d4594da
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions ciphers/Onepad_Cipher.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from __future__ import print_function


class Onepad:
def encrypt(self, text):
'''Function to encrypt text using psedo-random numbers'''
plain = []
plain = [ord(i) for i in text]
key = []
cipher = []
for i in text:
plain.append(ord(i))
for i in plain:
k = random.randint(1, 300)
c = (i+k)*k
Expand All @@ -21,8 +22,9 @@ def decrypt(self, cipher, key):
plain.append(chr(p))
plain = ''.join([i for i in plain])
return plain



if __name__ == '__main__':
c,k = Onepad().encrypt('Hello')
print c, k
print Onepad().decrypt(c, k)
c, k = Onepad().encrypt('Hello')
print(c, k)
print(Onepad().decrypt(c, k))

0 comments on commit d4594da

Please sign in to comment.