From a37d9c06a865d633277338a4c08115e20f3226ce Mon Sep 17 00:00:00 2001 From: Evan Su <48808396+HACKERALERT@users.noreply.github.com> Date: Tue, 3 Aug 2021 21:08:27 -0400 Subject: [PATCH] Reed Solomon almost works --- src/unstable/Picocrypt.go | 66 +++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/src/unstable/Picocrypt.go b/src/unstable/Picocrypt.go index d337a83..ca57f9e 100644 --- a/src/unstable/Picocrypt.go +++ b/src/unstable/Picocrypt.go @@ -1035,6 +1035,7 @@ func work(){ fast = flags[0]==1 paranoid = flags[1]==1 keyfile = flags[2]==1 + reedsolo = flags[3]==1 salt = make([]byte,48) fin.Read(salt) @@ -1234,10 +1235,10 @@ func work(){ //var _data []byte var data []byte - if reedsolo{ - data = make([]byte,1048576) - }else{ + if mode=="decrypt"&&reedsolo{ data = make([]byte,1114112) + }else{ + data = make([]byte,1048576) } size,err := fin.Read(data) @@ -1258,30 +1259,43 @@ func work(){ } chacha20.XORKeyStream(_data,data) if reedsolo{ + copy(data,_data) + _data = nil if len(data)==1048576{ - copy(data,_data) - _data = nil for i:=0;i<1048576;i+=128{ tmp := data[i:i+128] - tmp := rsEncode(rs128,tmp) - for _,j := range tmp{ + tmp = rsEncode(rs128,tmp) + /*for _,j := range tmp{ _data = append(_data,j) - } + }*/ + _data = append(_data,tmp...) } }else{ - + chunks := math.Floor(float64(len(data))/128) + for i:=0;float64(i)