Пример #1
0
    def main(self, *args, **kwargs):
        secret = self.read_key()
        x = Cipher(secret)
        content = None


        with open(path_to_file, 'rb') as fd:
            content = fd.read()
        assert content is not None, 'CANNOT READ FILE TO ENCRYPTION!!!'

        a = x.encrypt(content)
        with open('output1', 'wb') as fd:
            fd.write(a)
Пример #2
0
 def run(self, data, _key):
     state = State(data)
     key = Key(_key)
     cipher = Cipher(state, key)
     cipher.encrypt()
     cipher.decrypt()
Пример #3
0
def do_encryption(message, offset):
    alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
    process_method = CaesarCharProc(alphabet, offset)
    cipher = Cipher(process_method)
    encrypted_message = cipher.encrypt(message)
    print(f'Encrypted: {encrypted_message}')