Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

print() is a function in Python 3 #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))