From 81351f86fbae78792be73b977b8de7e02abc1e67 Mon Sep 17 00:00:00 2001 From: Evan Su <48808396+HACKERALERT@users.noreply.github.com> Date: Sun, 1 Aug 2021 23:13:48 -0400 Subject: [PATCH] Use golang.org/x/crypto/chacha20 --- src/unstable/Picocrypt.go | 370 ++++++++++++++------------------------ 1 file changed, 132 insertions(+), 238 deletions(-) diff --git a/src/unstable/Picocrypt.go b/src/unstable/Picocrypt.go index 7c3c062..892b76b 100644 --- a/src/unstable/Picocrypt.go +++ b/src/unstable/Picocrypt.go @@ -36,24 +36,26 @@ import ( "encoding/hex" "path/filepath" - // Reed-Solomon - "github.com/HACKERALERT/infectious" // v0.0.0-20210730231340-8af02cb9ed0a - // Cryptography "crypto/rand" + "crypto/hmac" + "crypto/subtle" "crypto/md5" "crypto/sha1" "crypto/sha256" "golang.org/x/crypto/argon2" + "golang.org/x/crypto/hkdf" "golang.org/x/crypto/sha3" "golang.org/x/crypto/blake2b" "golang.org/x/crypto/blake2s" - "golang.org/x/crypto/chacha20poly1305" - "github.com/HACKERALERT/Picocrypt/src/monocypher" + "golang.org/x/crypto/chacha20" // GUI "github.com/AllenDang/giu" + // Reed-Solomon + "github.com/HACKERALERT/infectious" // v0.0.0-20210730231340-8af02cb9ed0a + // Helpers "github.com/HACKERALERT/clipboard" // v0.1.5-0.20210716140604-61d96bf4fc94 "github.com/HACKERALERT/dialog" // v0.0.0-20210716143851-223edea1d840 @@ -119,7 +121,7 @@ var shredding = "Ready." var password string var cPassword string // Confirm password text entry string variable var keyfilePath string -var keyfileLabel = "Use a keyfile" +var keyfileLabel = "Use a keyfile (experimental)" var metadata string var shredTemp bool var serpent bool @@ -193,11 +195,13 @@ func startUI(){ }), giu.Button("Yes").Size(100,0).OnClick(func(){ giu.CloseCurrentPopup() + giu.Update() giu.OpenPopup(" ") go func (){ work() working = false debug.FreeOSMemory() + giu.Update() }() }), ), @@ -356,7 +360,7 @@ func startUI(){ giu.Row( giu.Checkbox("Encode with Reed-Solomon to prevent corruption",&reedsolo), giu.Button("?").Size(24,25).OnClick(func(){ - browser.OpenURL("https://bit.ly/reedsolomonwikipedia") + browser.OpenURL("https://bit.ly/3A2V7LR") }), ).Build() giu.Row( @@ -400,6 +404,7 @@ func startUI(){ work() working = false debug.FreeOSMemory() + giu.Update() }() } }), @@ -626,24 +631,29 @@ func onDrop(names []string){ fin,_ := os.Open(names[0]) // Read metadata and insert into box + var err error fin.Read(make([]byte,15)) tmp := make([]byte,30) fin.Read(tmp) - tmp,_ = rsDecode(rs10,tmp) - metadataLength,_ := strconv.Atoi(string(tmp)) + tmp,err = rsDecode(rs10,tmp) - tmp = make([]byte,metadataLength*3) - fin.Read(tmp) - metadata = "" + if err==nil{ + metadataLength,_ := strconv.Atoi(string(tmp)) + tmp = make([]byte,metadataLength*3) + fin.Read(tmp) + metadata = "" - for i:=0;i