1
0
Fork 0
mirror of https://github.com/HACKERALERT/Picocrypt.git synced 2024-09-20 17:56:35 +00:00

Updated for v1.3.6.4

This commit is contained in:
Evan Su 2021-02-21 11:48:15 -05:00 committed by GitHub
parent b0404d15e0
commit bf20aa6c8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,14 +6,14 @@
# Source: https://github.com/HACKERALERT/Picocrypt # Source: https://github.com/HACKERALERT/Picocrypt
try: try:
from argon2.low_level import hash_secret_raw,Type from argon2.low_level import hash_secret_raw
from Crypto.Cipher import ChaCha20_Poly1305 from Crypto.Cipher import ChaCha20_Poly1305
except: except:
from os import system from os import system
system("python3 -m pip install argon2-cffi") system("python3 -m pip install argon2-cffi")
system("python3 -m pip install pycryptodome") system("python3 -m pip install pycryptodome")
from tkinter import filedialog from tkinter import filedialog,messagebox
from threading import Thread from threading import Thread
from datetime import datetime from datetime import datetime
from argon2.low_level import hash_secret_raw,Type from argon2.low_level import hash_secret_raw,Type
@ -42,6 +42,7 @@ keepNotice = "Keep decrypted output even if it's corrupted or modified"
kept = False kept = False
eraseNotice = "Securely erase and delete original file" eraseNotice = "Securely erase and delete original file"
working = False working = False
overwriteNotice = "Output file already exists. Would you like to overwrite it?"
tk = tkinter.Tk() tk = tkinter.Tk()
tk.geometry("480x420") tk.geometry("480x420")
@ -143,6 +144,20 @@ passwordInput["state"] = "disabled"
def start(): def start():
global inputFile,outputFile,password,ad,kept,working global inputFile,outputFile,password,ad,kept,working
if ".pcf" not in inputFile:
mode = "encrypt"
outputFile = inputFile+".pcf"
else:
mode = "decrypt"
outputFile = inputFile[:-4]
try:
getsize(outputFile)
force = messagebox.askyesno("Warning",overwriteNotice)
dummy.focus()
if force!=1:
return
except:
pass
working = True working = True
dummy.focus() dummy.focus()
password = passwordInput.get().encode("utf-8") password = passwordInput.get().encode("utf-8")
@ -154,13 +169,6 @@ def start():
startBtn["state"] = "disabled" startBtn["state"] = "disabled"
keepBtn["state"] = "disabled" keepBtn["state"] = "disabled"
if ".pcf" not in inputFile:
mode = "encrypt"
outputFile = inputFile+".pcf"
else:
mode = "decrypt"
outputFile = inputFile[:-4]
fin = open(inputFile,"rb+") fin = open(inputFile,"rb+")
fout = open(outputFile,"wb+") fout = open(outputFile,"wb+")
@ -198,9 +206,9 @@ def start():
key = hash_secret_raw( key = hash_secret_raw(
password, password,
salt, salt,
time_cost=16, time_cost=8,
memory_cost=1048576, memory_cost=1048576,
parallelism=4, parallelism=8,
hash_len=32, hash_len=32,
type=Type.ID type=Type.ID
) )