Skip to content

Commit

Permalink
Fix ChaCha20 counter overflow #13
Browse files Browse the repository at this point in the history
  • Loading branch information
layou233 committed Mar 4, 2023
1 parent 2bc87d0 commit b08e901
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
github.com/showwin/speedtest-go v1.4.1
golang.org/x/crypto v0.5.0
golang.org/x/crypto v0.6.0
)

require golang.org/x/sys v0.4.0 // indirect
require golang.org/x/sys v0.5.0 // indirect
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/showwin/speedtest-go v1.4.1 h1:A+3gmwKIQz9RVlXSilLNadcH6j4wUXF0giIqQeANOdg=
github.com/showwin/speedtest-go v1.4.1/go.mod h1:Y7c+pxzaNAlo4mYP+x83pnYY8IM3bkHGDhTdrgUnkNE=
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
7 changes: 7 additions & 0 deletions waste/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ func CPU(interval time.Duration) {
}

fmt.Println("[CPU] Successfully wasted on", time.Now())

// try to construct a new cipher
newCipher, err := chacha20.NewUnauthenticatedCipher(buffer[:32], buffer[:24])
if err == nil {
cipher = newCipher
}

time.Sleep(interval)
}
}

0 comments on commit b08e901

Please sign in to comment.