Added pyperclip module copy feature for dec(msg)
Also now empty msgs will not be encrypted.
This commit is contained in:
parent
0c367699ed
commit
24bae73368
10
main.py
10
main.py
@ -9,6 +9,7 @@ import subprocess
|
||||
from more_itertools import sliced
|
||||
import json
|
||||
from fpdf import FPDF
|
||||
import pyperclip
|
||||
|
||||
# This function splits the secret and returns a list of shares
|
||||
def splitSecret(secret,threshold,splits):
|
||||
@ -251,13 +252,16 @@ class GUI:
|
||||
splits = int(self.PE1.get())
|
||||
threshold = int(self.PE2.get())
|
||||
if (threshold > splits or threshold<2) :
|
||||
messagebox.showwarning("Invalid!", "Minimum-Shares-Required should be greater than 2 and lesser than or equal to Total-Shares ")
|
||||
messagebox.showwarning("Invalid!", "Minimum-Shares-Required should be greater than 2 and lesser than or equal to Total-Shares")
|
||||
return
|
||||
self.PE1.config(state='disabled')
|
||||
self.PE2.config(state='disabled')
|
||||
self.PTextBox.config(state='disabled')
|
||||
key = keyGen()
|
||||
plaintext = self.PTextBox.get("1.0",'end-1c')
|
||||
if (plaintext== ""):
|
||||
messagebox.showwarning("Invalid!","Message Text Box Cannot Be Left Blank!")
|
||||
return
|
||||
shared_key = splitSecret(key,threshold,splits)
|
||||
ciphertext = encryptMsg(plaintext,key)
|
||||
try:
|
||||
@ -345,7 +349,9 @@ class GUI:
|
||||
GScroll.pack(side = RIGHT,fill = Y)
|
||||
GTextFrame.grid(column=1,columnspan=2)
|
||||
self.GBackButton=Button(self.GetFrame,text="Back",command=self.Main)
|
||||
self.GBackButton.grid(column=1)
|
||||
self.GBackButton.grid(column=1)
|
||||
self.CopyButton=Button(self.GetFrame,text="Copy",command=pyperclip.copy(plaintext))
|
||||
self.CopyButton.grid(column=1)
|
||||
|
||||
root = Tk()
|
||||
root.title("FloSecret")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user