Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Encrypt 2
# Encrypt 2 # Decryptor is available here: http://rextester.com/OHW31981 def keyboard(): try: while True: for char in input(): yield char yield '\n' except EOFError: pass class Encryptor: def __init__(self, primary_key): self.key = list(map(ord, primary_key)) self.key_index = 0 def __call__(self, char_to_encrypt): encrypted_char = ord(char_to_encrypt) ^ self.key[self.key_index] self.key[self.key_index] = ord(char_to_encrypt) self.key_index += 1 self.key_index %= len(self.key) return encrypted_char encrypted_stream_generator = map(Encryptor(input()), keyboard()) print(next(encrypted_stream_generator), end='') for i in encrypted_stream_generator: print(',', i, end='')
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Hw
kaam ki chiz
Tupples
PYTHON 3 ÖDEV :)
guesssss
Lesson8
word repeat
binary_search
Exercise 4 for lesson 2
binary
Please log in to post a comment.