/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
simplecrypt__example/hello_world.py
30 строк
629 B
gil9red
Refactoring. Using f-strings
26 июн 2023, 15:16
26 июн 2023, 15:16
f62c2df
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "ipetrash" import binascii # pip install simple-crypt # https://github.com/andrewcooke/simple-crypt from simplecrypt import encrypt, decrypt message = "Hello World!" password = "secret" print(f'message: "{message}"') print(f'password: "{password}"') print() ciphertext = encrypt(password, message) print(f'ciphertext[{len(ciphertext)}]: "{ciphertext}"') ciphertext_hex = binascii.hexlify(ciphertext) print(f'ciphertext_hex[{len(ciphertext_hex)}]: "{ciphertext_hex}"') print() print("After decrypt:") plaintext = decrypt(password, ciphertext) print(plaintext)