-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (23 loc) · 742 Bytes
/
main.py
File metadata and controls
30 lines (23 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from my_des import *
from rich import print
from rich.text import Text
from rich.panel import Panel
def main():
print(Panel(Text('Welcome to use my DES encryptor!', 'bold green', justify='center')))
print('[cyan b]Plaintext: [/]', end='')
plaintext = input()
print('[cyan b]Key: [/]', end='')
key = input()
plaintext, key = bytes.fromhex(plaintext), bytes.fromhex(key)
if len(plaintext) != 8 or len(key) != 8:
print(Panel(
Text('(×) ERROR: Length of plaintext or key is not 8', justify='center'),
style='red bold',
))
return
des_encrypt(plaintext, key)
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
print('\n')