File tree Expand file tree Collapse file tree 6 files changed +97
-2
lines changed
Expand file tree Collapse file tree 6 files changed +97
-2
lines changed Original file line number Diff line number Diff line change 99
1010### v0.5.x
1111
12- * [ ] 支持 ECDSA 算法
13- * [ ] 支持 EdDSA 算法
12+ * [ ] 支持 X25519 算法
13+ * [x ] 支持 ED25519 算法
1414* [x] 重构代码,优化使用方式
1515* [ ] 提升覆盖率到 90% 以上
1616
Original file line number Diff line number Diff line change 11## 📜 历史版本的特性介绍 (Features in old versions)
22
3+ ### v0.5.1-alpha
4+
5+ > 此版本发布于 2025-12-07
6+
7+ * 增加 ED25519 算法的支持
8+
39### v0.5.0-alpha
410
511> 此版本发布于 2025-12-05
Original file line number Diff line number Diff line change @@ -122,6 +122,11 @@ BenchmarkRSA_VerifyPSS-2 20220 56627 ns/op
122122BenchmarkRSA_GenerateKeys1024-2 60 21398224 ns/op 283350 B/op 2851 allocs/op
123123BenchmarkRSA_GenerateKeys2048-2 84 117753488 ns/op 600303 B/op 5459 allocs/op
124124BenchmarkRSA_GenerateKeys4096-2 1 1432974432 ns/op 2709912 B/op 14359 allocs/op
125+
126+ BenchmarkED25519_Sign-2 32125 36469 ns/op 112 B/op 2 allocs/op
127+ BenchmarkED25519_Verify-2 13927 90989 ns/op 48 B/op 1 allocs/op
128+
129+ BenchmarkED25519_GenerateKeys-2 38296 30692 ns/op 208 B/op 4 allocs/op
125130```
126131
127132### 🎨 Contributing
Original file line number Diff line number Diff line change @@ -122,6 +122,11 @@ BenchmarkRSA_VerifyPSS-2 20220 56627 ns/op
122122BenchmarkRSA_GenerateKeys1024-2 60 21398224 ns/op 283350 B/op 2851 allocs/op
123123BenchmarkRSA_GenerateKeys2048-2 84 117753488 ns/op 600303 B/op 5459 allocs/op
124124BenchmarkRSA_GenerateKeys4096-2 1 1432974432 ns/op 2709912 B/op 14359 allocs/op
125+
126+ BenchmarkED25519_Sign-2 32125 36469 ns/op 112 B/op 2 allocs/op
127+ BenchmarkED25519_Verify-2 13927 90989 ns/op 48 B/op 1 allocs/op
128+
129+ BenchmarkED25519_GenerateKeys-2 38296 30692 ns/op 208 B/op 4 allocs/op
125130```
126131
127132### 🎨 贡献者
Original file line number Diff line number Diff line change 1+ // Copyright 2025 FishGoddess. All rights reserved.
2+ // Use of this source code is governed by a MIT style
3+ // license that can be found in the LICENSE file.
4+
5+ package main
6+
7+ import (
8+ "testing"
9+
10+ "github.com/FishGoddess/cryptox/ed25519"
11+ )
12+
13+ // go test -v -bench=^BenchmarkED25519_GenerateKeys$ -benchtime=1s ed25519_key_test.go
14+ func BenchmarkED25519_GenerateKeys (b * testing.B ) {
15+ b .ReportAllocs ()
16+ b .ResetTimer ()
17+
18+ for i := 0 ; i < b .N ; i ++ {
19+ _ , _ , err := ed25519 .GenerateKeys ()
20+ if err != nil {
21+ b .Fatal (err )
22+ }
23+ }
24+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2025 FishGoddess. All rights reserved.
2+ // Use of this source code is governed by a MIT style
3+ // license that can be found in the LICENSE file.
4+
5+ package main
6+
7+ import (
8+ "testing"
9+
10+ "github.com/FishGoddess/cryptox/ed25519"
11+ )
12+
13+ var (
14+ ed25519BenchData = []byte ("你好,世界" )
15+ )
16+
17+ // go test -v -bench=^BenchmarkED25519_Sign$ -benchtime=1s ed25519_test.go
18+ func BenchmarkED25519_Sign (b * testing.B ) {
19+ privateKey , err := ed25519 .LoadPrivateKey ("ed25519.key" )
20+ if err != nil {
21+ b .Fatal (err )
22+ }
23+
24+ b .ReportAllocs ()
25+ b .ResetTimer ()
26+
27+ for i := 0 ; i < b .N ; i ++ {
28+ privateKey .Sign (ed25519BenchData )
29+ }
30+ }
31+
32+ // go test -v -bench=^BenchmarkED25519_Verify$ -benchtime=1s ed25519_test.go
33+ func BenchmarkED25519_Verify (b * testing.B ) {
34+ privateKey , err := ed25519 .LoadPrivateKey ("ed25519.key" )
35+ if err != nil {
36+ b .Fatal (err )
37+ }
38+
39+ publicKey , err := ed25519 .LoadPublicKey ("ed25519.pub" )
40+ if err != nil {
41+ b .Fatal (err )
42+ }
43+
44+ sign := privateKey .Sign (ed25519BenchData )
45+
46+ b .ReportAllocs ()
47+ b .ResetTimer ()
48+
49+ for i := 0 ; i < b .N ; i ++ {
50+ err = publicKey .Verify (ed25519BenchData , sign )
51+ if err != nil {
52+ b .Fatal (err )
53+ }
54+ }
55+ }
You can’t perform that action at this time.
0 commit comments