Skip to content

Commit

Permalink
optimize QPP performance
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Dec 22, 2024
1 parent 88f939b commit ebf9455
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 63 deletions.
4 changes: 2 additions & 2 deletions crypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (c *qppCrypt) Encrypt(dst, src []byte) {
seed := make([]byte, 8+len(c.key))
copy(seed, dst[:8])
copy(seed[8:], c.key)
prng := c.quantum.CreatePRNG(seed)
prng := qpp.FastPRNG(seed)
c.quantum.EncryptWithPRNG(dst[8:], prng)
}

Expand All @@ -271,7 +271,7 @@ func (c *qppCrypt) Decrypt(dst, src []byte) {
seed := make([]byte, 8+len(c.key))
copy(seed, dst[:8])
copy(seed[8:], c.key)
prng := c.quantum.CreatePRNG(seed)
prng := qpp.FastPRNG(seed)
c.quantum.DecryptWithPRNG(dst[8:], prng)
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/templexxx/xorsimd v0.4.3
github.com/tjfoc/gmsm v1.4.1
github.com/xtaci/gaio v1.2.24
github.com/xtaci/qpp v1.1.17
github.com/xtaci/qpp v1.1.18
golang.org/x/crypto v0.31.0
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ github.com/xtaci/gaio v1.2.24 h1:YESSPj6cFsf2WCpsRIngLY9w42WfIz61KZyYs6N3Ojg=
github.com/xtaci/gaio v1.2.24/go.mod h1:3jAZo6WyD8rtO6bj/h3atSsGjQbm5a4zbAhJ3JotVbU=
github.com/xtaci/qpp v1.1.17 h1:w35NYqF3wOBoAMs+2qA2XFjkNQ12mugw51CUJ7OcTzo=
github.com/xtaci/qpp v1.1.17/go.mod h1:dJS3usaXNMbWxZSWCAdxz01UgJcz9wXDkd4BccDY/V0=
github.com/xtaci/qpp v1.1.18 h1:FyULigD8/msXdxj9AjOFQg3/Z/tGz4574n21shZ6SZo=
github.com/xtaci/qpp v1.1.18/go.mod h1:DI0dcoZ+qu4ze5C0hkt8grLfTVqBiZ3hXTimGyg5TTI=
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
Expand Down
1 change: 1 addition & 0 deletions vendor/github.com/xtaci/qpp/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 52 additions & 37 deletions vendor/github.com/xtaci/qpp/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions vendor/github.com/xtaci/qpp/pkg.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions vendor/github.com/xtaci/qpp/prng.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 38 additions & 22 deletions vendor/github.com/xtaci/qpp/qpp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ github.com/tjfoc/gmsm/sm4
# github.com/xtaci/gaio v1.2.24
## explicit; go 1.13
github.com/xtaci/gaio
# github.com/xtaci/qpp v1.1.17
# github.com/xtaci/qpp v1.1.18
## explicit; go 1.22.3
github.com/xtaci/qpp
# go.uber.org/atomic v1.9.0
Expand Down

0 comments on commit ebf9455

Please sign in to comment.