-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcryptographicMachineGUI.py
More file actions
42 lines (34 loc) · 1.16 KB
/
cryptographicMachineGUI.py
File metadata and controls
42 lines (34 loc) · 1.16 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
import onetimepad
from tkinter import *
root = Tk()
root.title("Cryptograhy Machine")
root.geometry("800x800")
def encryptMsg():
pt = e1.get()
ct = onetimepad.encrypt(pt, 'random')
e2.insert(0, ct)
def decryptMsg():
ct1 = e3.get()
pt1 = onetimepad.decrypt(ct1, 'random')
e4.insert(0, pt1)
label1 = Label(root, text ='Plain Text')
label1.grid(row = 10, column = 1)
label2 = Label(root, text ='Encrypted Text')
label2.grid(row = 11, column = 1)
l3 = Label(root, text ="Cipher Text")
l3.grid(row = 10, column = 10)
l4 = Label(root, text ="Decrypted text")
l4.grid(row = 11, column = 10)
e1 = Entry(root)
e1.grid(row = 10, column = 2)
e2 = Entry(root)
e2.grid(row = 11, column = 2)
e3 = Entry(root)
e3.grid(row = 10, column = 11)
e4 = Entry(root)
e4.grid(row = 11, column = 11)
ent = Button(root, text = "encrypt", bg ="red", fg ="white", command = encryptMessage)
ent.grid(row = 13, column = 2)
b2 = Button(root, text = "decrypt", bg ="green", fg ="white", command = decryptMessage)
b2.grid(row = 13, column = 11)
root.mainloop()