mirror of
https://github.com/HACKERALERT/Picocrypt.git
synced 2024-09-30 00:56:20 +13:00
Update Picocrypt.go
This commit is contained in:
parent
bd07fde788
commit
12e66b5b0f
1 changed files with 45 additions and 9 deletions
|
@ -286,7 +286,19 @@ func startUI(){
|
||||||
giu.PopupModal(s("Manage keyfile(s):")).Layout(
|
giu.PopupModal(s("Manage keyfile(s):")).Layout(
|
||||||
giu.Custom(func(){
|
giu.Custom(func(){
|
||||||
for _,i := range keyfiles{
|
for _,i := range keyfiles{
|
||||||
giu.Label(i).Build()
|
giu.Row(
|
||||||
|
giu.Label(filepath.Base(i)),
|
||||||
|
giu.Button("Remove").OnClick(func(){
|
||||||
|
var tmp []string
|
||||||
|
for _,j := range keyfiles{
|
||||||
|
if j!=i{
|
||||||
|
tmp = append(tmp,j)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
keyfiles = tmp
|
||||||
|
}),
|
||||||
|
).Build()
|
||||||
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
giu.Row(
|
giu.Row(
|
||||||
|
@ -294,13 +306,13 @@ func startUI(){
|
||||||
giu.Button(s("Clear")).Size(150,0).OnClick(func(){
|
giu.Button(s("Clear")).Size(150,0).OnClick(func(){
|
||||||
keyfiles = nil
|
keyfiles = nil
|
||||||
}),
|
}),
|
||||||
giu.Button(s("Close")).Size(150,0).OnClick(func(){
|
giu.Button(s("Done")).Size(150,0).OnClick(func(){
|
||||||
giu.CloseCurrentPopup()
|
giu.CloseCurrentPopup()
|
||||||
showKeyfile = false
|
showKeyfile = false
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
).Build()
|
).Build()
|
||||||
giu.OpenPopup(s("Manage keyfiles:"))
|
giu.OpenPopup(s("Manage keyfile(s):"))
|
||||||
giu.Update()
|
giu.Update()
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
@ -460,7 +472,7 @@ func startUI(){
|
||||||
giu.Dummy(-0.0000001,0),
|
giu.Dummy(-0.0000001,0),
|
||||||
),
|
),
|
||||||
giu.Row(
|
giu.Row(
|
||||||
giu.InputText(&password).Size(-16).Flags(passwordState).OnChange(func(){
|
giu.InputText(&password).Size(440/dpi).Flags(passwordState).OnChange(func(){
|
||||||
passwordStrength = zxcvbn.PasswordStrength(password,nil).Score
|
passwordStrength = zxcvbn.PasswordStrength(password,nil).Score
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -504,7 +516,7 @@ func startUI(){
|
||||||
if mode!="decrypt"{
|
if mode!="decrypt"{
|
||||||
giu.Label(s("Confirm password:")).Build()
|
giu.Label(s("Confirm password:")).Build()
|
||||||
giu.Row(
|
giu.Row(
|
||||||
giu.InputText(&cPassword).Size(-16).Flags(passwordState),
|
giu.InputText(&cPassword).Size(440/dpi).Flags(passwordState),
|
||||||
giu.Custom(func(){
|
giu.Custom(func(){
|
||||||
canvas := giu.GetCanvas()
|
canvas := giu.GetCanvas()
|
||||||
pos := giu.GetCursorScreenPos()
|
pos := giu.GetCursorScreenPos()
|
||||||
|
@ -585,12 +597,11 @@ func startUI(){
|
||||||
giu.Tooltip(s("Removes the encrypted Picocrypt volume (and chunks).")).Build()
|
giu.Tooltip(s("Removes the encrypted Picocrypt volume (and chunks).")).Build()
|
||||||
giu.Dummy(0,112).Build()
|
giu.Dummy(0,112).Build()
|
||||||
}else{
|
}else{
|
||||||
fmt.Println(dpi)
|
//fmt.Println(dpi)
|
||||||
giu.Dummy(0,67).Build()
|
giu.Dummy(0,67).Build()
|
||||||
w,_ := giu.GetAvailableRegion()
|
w,_ := giu.GetAvailableRegion()
|
||||||
tw,_ := giu.CalcTextSize(s("No files selected yet."))
|
tw,_ := giu.CalcTextSize(s("No files selected yet."))
|
||||||
padding,_ := giu.GetWindowPadding()
|
//fmt.Println(w,tw,padding)
|
||||||
fmt.Println(w,tw,padding)
|
|
||||||
giu.Row(
|
giu.Row(
|
||||||
giu.Label(""),
|
giu.Label(""),
|
||||||
giu.Dummy((w-tw)/2/dpi,0),
|
giu.Dummy((w-tw)/2/dpi,0),
|
||||||
|
@ -898,7 +909,7 @@ func onDrop(names []string){
|
||||||
recombine = false
|
recombine = false
|
||||||
if tab==0{
|
if tab==0{
|
||||||
if showKeyfile{
|
if showKeyfile{
|
||||||
keyfiles = names
|
keyfiles = append(keyfiles,names...)
|
||||||
giu.Update()
|
giu.Update()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1471,6 +1482,31 @@ func work(){
|
||||||
khash_sha3.Write(khash)
|
khash_sha3.Write(khash)
|
||||||
khash_hash = khash_sha3.Sum(nil)
|
khash_hash = khash_sha3.Sum(nil)
|
||||||
}*/
|
}*/
|
||||||
|
if len(keyfiles)>0{
|
||||||
|
var keysum []byte
|
||||||
|
for _,path := range keyfiles{
|
||||||
|
kin,_ := os.Open(path)
|
||||||
|
kstat,_ := os.Stat(path)
|
||||||
|
kbytes := make([]byte,kstat.Size())
|
||||||
|
kin.Read(kbytes)
|
||||||
|
kin.Close()
|
||||||
|
ksha3 := sha3.New256()
|
||||||
|
ksha3.Write(kbytes)
|
||||||
|
khash := ksha3.Sum(nil)
|
||||||
|
if keysum==nil{
|
||||||
|
keysum = khash
|
||||||
|
}else{
|
||||||
|
for i,j := range khash{
|
||||||
|
keysum[i] ^= j
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Println(path,keysum)
|
||||||
|
}
|
||||||
|
khash = keysum
|
||||||
|
khash_sha3 := sha3.New256()
|
||||||
|
khash_sha3.Write(keysum)
|
||||||
|
khash_hash = khash_sha3.Sum(nil)
|
||||||
|
}
|
||||||
|
|
||||||
sha3_512 := sha3.New512()
|
sha3_512 := sha3.New512()
|
||||||
sha3_512.Write(key)
|
sha3_512.Write(key)
|
||||||
|
|
Loading…
Reference in a new issue