Merge pull request #42 from Picocrypt/better-cleanup-and-zip-info

Better cleanup and zip info
This commit is contained in:
Evan Su 2025-04-12 20:31:22 -04:00 committed by GitHub
commit 14b49f0951
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 7 deletions

View file

@ -1 +1 @@
1.47
1.48

View file

@ -1,9 +1,11 @@
module github.com/Picocrypt/CLI/picocrypt
go 1.24
go 1.24.0
toolchain go1.24.1
require (
github.com/Picocrypt/infectious v0.0.0-20240830233326-3a050f65f9ec
github.com/Picocrypt/infectious v0.0.0-20250412183341-9f88c6307b39
github.com/Picocrypt/serpent v0.0.0-20240830233833-9ad6ab254fd7
github.com/schollz/progressbar/v3 v3.18.0
golang.org/x/crypto v0.37.0

View file

@ -1,5 +1,5 @@
github.com/Picocrypt/infectious v0.0.0-20240830233326-3a050f65f9ec h1:/cop0/v0HxIJm1XGDgIlzNJ3e4HhM8nIUPZi5RZ/n1w=
github.com/Picocrypt/infectious v0.0.0-20240830233326-3a050f65f9ec/go.mod h1:aaFq/WMVxrU2Exl/tXbTFSXajZrqw0mgn/wi42n0fK4=
github.com/Picocrypt/infectious v0.0.0-20250412183341-9f88c6307b39 h1:czHyPoiNrILv9xjfQ87UFllJgak8W6gVcYkmfOay/BE=
github.com/Picocrypt/infectious v0.0.0-20250412183341-9f88c6307b39/go.mod h1:2ZVEanURxuWmxYZ6W6xMMy4ZR6xmQr16Vq/XPTLIspQ=
github.com/Picocrypt/serpent v0.0.0-20240830233833-9ad6ab254fd7 h1:G36G2vmQAS7CVoHQrHDGAoCWll/0kPCI8Dk7mgwcJFE=
github.com/Picocrypt/serpent v0.0.0-20240830233833-9ad6ab254fd7/go.mod h1:BxsgRYwUVd92aEwXnXsfXfHw8aHlD/PUyExC/wwk9oI=
github.com/chengxilo/virtualterm v1.0.4 h1:Z6IpERbRVlfB8WkOmtbHiDbBANU7cimRIof7mk9/PwM=

View file

@ -185,7 +185,7 @@ func compress() int {
return 1
}
dir = filepath.ToSlash(dir)
file, err = os.CreateTemp("", "picocrypt-cli-v2-*.tmp")
file, err = os.CreateTemp("", "picocrypt-cli-v2-*.zip.tmp")
if err != nil {
fmt.Println("Cannot create temporary file!")
return 1
@ -193,6 +193,8 @@ func compress() int {
pzip = file.Name()
writer = zip.NewWriter(file)
fmt.Println("Info: creating temporary zip file " + pzip)
for i, path := range files {
stat, err := os.Stat(path)
if err != nil {
@ -344,7 +346,7 @@ func work() int {
hkdfSalt = make([]byte, 32)
serpentIV = make([]byte, 16)
nonce = make([]byte, 24)
_, errs[0] = fout.Write(rsEncode(rs5, []byte("v1.46")))
_, errs[0] = fout.Write(rsEncode(rs5, []byte("v1.48")))
_, errs[1] = fout.Write(rsEncode(rs5, []byte("00000")))
flags := make([]byte, 5)
if *p {
@ -685,4 +687,13 @@ func main() {
}
os.Exit(1)
}
td := os.TempDir()
matches, err := filepath.Glob(filepath.Join(td, "picocrypt-cli-v2-*.zip.tmp"))
if err != nil {
panic(err)
}
for _, v := range matches {
os.Remove(v)
}
}