Update Picocrypt.go

This commit is contained in:
Evan Su 2021-05-12 16:31:01 -04:00 committed by GitHub
parent fc4e543b7b
commit 3884eb4aa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 8 deletions

View File

@ -37,7 +37,7 @@ import (
//"github.com/AllenDang/imgui-go" //"github.com/AllenDang/imgui-go"
"github.com/klauspost/reedsolomon" "github.com/klauspost/reedsolomon"
"golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/chacha20poly1305"
"github.com/HACKERALERT/Monocypher-Go/monocypher" "github.com/HACKERALERT/Picocypher/monocypher"
) )
// Global variables // Global variables
@ -244,7 +244,7 @@ func startUI(){
g.Dummy(10,0), g.Dummy(10,0),
g.Line( g.Line(
g.Checkbox("SHA1:",&sha1_selected), g.Checkbox("SHA1:",&sha1_selected),
g.Dummy(353,0), g.Dummy(352,0),
g.Button("Copy").OnClick(func(){ g.Button("Copy").OnClick(func(){
clipboard.WriteAll(cs_sha1) clipboard.WriteAll(cs_sha1)
}), }),
@ -255,7 +255,7 @@ func startUI(){
g.Dummy(10,0), g.Dummy(10,0),
g.Line( g.Line(
g.Checkbox("SHA256:",&sha256_selected), g.Checkbox("SHA256:",&sha256_selected),
g.Dummy(341,0), g.Dummy(338,0),
g.Button("Copy").OnClick(func(){ g.Button("Copy").OnClick(func(){
clipboard.WriteAll(cs_sha256) clipboard.WriteAll(cs_sha256)
}), }),
@ -266,7 +266,7 @@ func startUI(){
g.Dummy(10,0), g.Dummy(10,0),
g.Line( g.Line(
g.Checkbox("SHA3-256:",&sha3_256_selected), g.Checkbox("SHA3-256:",&sha3_256_selected),
g.Dummy(334,0), g.Dummy(324,0),
g.Button("Copy").OnClick(func(){ g.Button("Copy").OnClick(func(){
clipboard.WriteAll(cs_sha3_256) clipboard.WriteAll(cs_sha3_256)
}), }),
@ -277,7 +277,7 @@ func startUI(){
g.Dummy(10,0), g.Dummy(10,0),
g.Line( g.Line(
g.Checkbox("BLAKE2b:",&blake2b_selected), g.Checkbox("BLAKE2b:",&blake2b_selected),
g.Dummy(320,0), g.Dummy(332,0),
g.Button("Copy").OnClick(func(){ g.Button("Copy").OnClick(func(){
clipboard.WriteAll(cs_blake2b) clipboard.WriteAll(cs_blake2b)
}), }),
@ -288,7 +288,7 @@ func startUI(){
g.Dummy(10,0), g.Dummy(10,0),
g.Line( g.Line(
g.Checkbox("BLAKE2s:",&blake2s_selected), g.Checkbox("BLAKE2s:",&blake2s_selected),
g.Dummy(320,0), g.Dummy(332,0),
g.Button("Copy").OnClick(func(){ g.Button("Copy").OnClick(func(){
clipboard.WriteAll(cs_blake2s) clipboard.WriteAll(cs_blake2s)
}), }),
@ -299,7 +299,7 @@ func startUI(){
g.Dummy(10,0), g.Dummy(10,0),
g.Line( g.Line(
g.Checkbox("BLAKE3:",&blake3_selected), g.Checkbox("BLAKE3:",&blake3_selected),
g.Dummy(323,0), g.Dummy(338,0),
g.Button("Copy").OnClick(func(){ g.Button("Copy").OnClick(func(){
clipboard.WriteAll(cs_blake3) clipboard.WriteAll(cs_blake3)
}), }),
@ -710,7 +710,13 @@ func work(){
}else{ }else{
//fmt.Println("DECODE LOOP") //fmt.Println("DECODE LOOP")
crc.Write(data) crc.Write(data)
data,_ := cipher.Open(nil,_nonce,data,nil) if fast{
data,_ = cipher.Open(nil,_nonce,data,nil)
}else{
mac := data[len(data)-16:]
data = data[:len(data)-16]
data,_ = monocypher.Unlock(data,_nonce,key,mac)
}
fout.Write(data) fout.Write(data)
//fmt.Println(authentic) //fmt.Println(authentic)
//fmt.Println("DECRYPTED DATA: ",data) //fmt.Println("DECRYPTED DATA: ",data)