mirror of
https://github.com/HACKERALERT/Picocrypt.git
synced 2025-01-01 12:22:25 +00:00
Finalize v1.27
This commit is contained in:
parent
6098afdeb1
commit
5b749c17db
1 changed files with 33 additions and 15 deletions
|
@ -100,7 +100,7 @@ var reedsolo bool
|
||||||
var deleteWhenDone bool
|
var deleteWhenDone bool
|
||||||
var split bool
|
var split bool
|
||||||
var splitSize string
|
var splitSize string
|
||||||
var splitUnits = []string{"KiB", "MiB", "GiB", "TiB"}
|
var splitUnits = []string{"KiB", "MiB", "GiB", "TiB", "Total"}
|
||||||
var splitSelected int32 = 1
|
var splitSelected int32 = 1
|
||||||
var compress bool
|
var compress bool
|
||||||
var keep bool
|
var keep bool
|
||||||
|
@ -408,14 +408,20 @@ func draw() {
|
||||||
),
|
),
|
||||||
|
|
||||||
giu.Separator(),
|
giu.Separator(),
|
||||||
|
giu.Style().SetDisabled((mode == "decrypt" && comments == "") ||
|
||||||
|
(mode != "decrypt" && ((len(keyfiles) == 0 && password == "") || (password != cpassword)))).To(
|
||||||
|
giu.Style().SetDisabled(mode == "decrypt" && comments == "").To(
|
||||||
|
giu.Label(commentsPrompt),
|
||||||
|
giu.InputText(&comments).Size(giu.Auto).Flags(func() giu.InputTextFlags {
|
||||||
|
if commentsDisabled {
|
||||||
|
return giu.InputTextFlagsReadOnly
|
||||||
|
}
|
||||||
|
return giu.InputTextFlagsNone
|
||||||
|
}()),
|
||||||
|
),
|
||||||
|
),
|
||||||
giu.Style().SetDisabled((len(keyfiles) == 0 && password == "") ||
|
giu.Style().SetDisabled((len(keyfiles) == 0 && password == "") ||
|
||||||
(mode == "encrypt" && password != cpassword)).To(
|
(mode == "encrypt" && password != cpassword)).To(
|
||||||
|
|
||||||
giu.Label(commentsPrompt),
|
|
||||||
giu.Style().SetDisabled(commentsDisabled).To(
|
|
||||||
giu.InputText(&comments).Size(giu.Auto),
|
|
||||||
),
|
|
||||||
|
|
||||||
giu.Label("Advanced:"),
|
giu.Label("Advanced:"),
|
||||||
giu.Custom(func() {
|
giu.Custom(func() {
|
||||||
if mode != "decrypt" {
|
if mode != "decrypt" {
|
||||||
|
@ -528,7 +534,13 @@ func draw() {
|
||||||
mainStatusColor = color.RGBA{0xff, 0x00, 0x00, 0xff}
|
mainStatusColor = color.RGBA{0xff, 0x00, 0x00, 0xff}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_, err := os.Stat(outputFile)
|
tmp, err := strconv.Atoi(splitSize)
|
||||||
|
if split && (splitSize == "" || tmp <= 0 || err != nil) {
|
||||||
|
mainStatus = "Invalid split size."
|
||||||
|
mainStatusColor = color.RGBA{0xff, 0x00, 0x00, 0xff}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_, err = os.Stat(outputFile)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
modalId++
|
modalId++
|
||||||
showConfirmation = true
|
showConfirmation = true
|
||||||
|
@ -1413,16 +1425,16 @@ func work() {
|
||||||
|
|
||||||
// Update stats
|
// Update stats
|
||||||
if mode == "decrypt" && reedsolo {
|
if mode == "decrypt" && reedsolo {
|
||||||
done += 1<<20/128*136
|
done += 1 << 20 / 128 * 136
|
||||||
} else {
|
} else {
|
||||||
done += 1<<20
|
done += 1 << 20
|
||||||
}
|
}
|
||||||
counterDone += 1<<20
|
counterDone += 1 << 20
|
||||||
counter++
|
counter++
|
||||||
progress = float32(done) / float32(total)
|
progress = float32(done) / float32(total)
|
||||||
elapsed := float64(time.Since(startTime)) / (1<<20) / 1000
|
elapsed := float64(time.Since(startTime)) / (1 << 20) / 1000
|
||||||
speed := float64(done) / elapsed / (1 << 20)
|
speed := float64(done) / elapsed / (1 << 20)
|
||||||
eta := int(math.Floor(float64(total-int64(done)) / (speed * (1<<20))))
|
eta := int(math.Floor(float64(total-int64(done)) / (speed * (1 << 20))))
|
||||||
progress = float32(math.Min(float64(progress), 1)) // Cap progress to 100%
|
progress = float32(math.Min(float64(progress), 1)) // Cap progress to 100%
|
||||||
progressInfo = fmt.Sprintf("%.2f%%", progress*100)
|
progressInfo = fmt.Sprintf("%.2f%%", progress*100)
|
||||||
popupStatus = fmt.Sprintf("Working at %.2f MiB/s (ETA: %s)", speed, humanize(eta))
|
popupStatus = fmt.Sprintf("Working at %.2f MiB/s (ETA: %s)", speed, humanize(eta))
|
||||||
|
@ -1471,15 +1483,17 @@ func work() {
|
||||||
finishedRaw := 0
|
finishedRaw := 0
|
||||||
chunkSize, _ := strconv.Atoi(splitSize)
|
chunkSize, _ := strconv.Atoi(splitSize)
|
||||||
|
|
||||||
// User can choose KiB, MiB, GiB, or TiB
|
// User can choose KiB, MiB, GiB, TiB, or custom number of chunks
|
||||||
if splitSelected == 0 {
|
if splitSelected == 0 {
|
||||||
chunkSize *= 1 << 10
|
chunkSize *= 1 << 10
|
||||||
} else if splitSelected == 1 {
|
} else if splitSelected == 1 {
|
||||||
chunkSize *= 1 << 20
|
chunkSize *= 1 << 20
|
||||||
} else if splitSelected == 2 {
|
} else if splitSelected == 2 {
|
||||||
chunkSize *= 1 << 30
|
chunkSize *= 1 << 30
|
||||||
} else {
|
} else if splitSelected == 3 {
|
||||||
chunkSize *= 1 << 40
|
chunkSize *= 1 << 40
|
||||||
|
} else {
|
||||||
|
chunkSize = int(math.Ceil(float64(size) / float64(chunkSize)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the number of required chunks
|
// Get the number of required chunks
|
||||||
|
@ -1495,6 +1509,10 @@ func work() {
|
||||||
// Copy data into the chunk
|
// Copy data into the chunk
|
||||||
for {
|
for {
|
||||||
data := make([]byte, 1<<20)
|
data := make([]byte, 1<<20)
|
||||||
|
for done+len(data) > chunkSize {
|
||||||
|
data = make([]byte, int(math.Ceil(float64(len(data))/2)))
|
||||||
|
}
|
||||||
|
|
||||||
read, err := fin.Read(data)
|
read, err := fin.Read(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue