From 81e738aeffdd82811ccd6e5392e52e03317d001a Mon Sep 17 00:00:00 2001 From: Sun Yimin Date: Thu, 23 May 2024 13:17:18 +0800 Subject: [PATCH] =?UTF-8?q?Updated=20SM2=E5=8A=A0=E8=A7=A3=E5=AF=86?= =?UTF-8?q?=E6=80=A7=E8=83=BD=20(markdown)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SM2加解密性能.md | 59 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/SM2加解密性能.md b/SM2加解密性能.md index 1212b2e..77e34e2 100644 --- a/SM2加解密性能.md +++ b/SM2加解密性能.md @@ -130,5 +130,62 @@ BenchmarkSM4GCMSeal8K BenchmarkSM4GCMSeal8K-6 76536 15293 ns/op 535.67 MB/s 0 B/op 0 allocs/op ``` -总体而言,SM2加密算法并不适合大数据量的加密。 + +KDF AVX2 8路并行后: +``` +goos: windows +goarch: amd64 +pkg: github.com/emmansun/gmsm/sm3 +cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz +BenchmarkKdfWithSM3 +BenchmarkKdfWithSM3/zLen=32-kLen=32 +BenchmarkKdfWithSM3/zLen=32-kLen=32-6 + 5110020 229.9 ns/op 32 B/op 1 allocs/op +BenchmarkKdfWithSM3/zLen=32-kLen=64 +BenchmarkKdfWithSM3/zLen=32-kLen=64-6 + 2790901 423.9 ns/op 64 B/op 1 allocs/op +BenchmarkKdfWithSM3/zLen=32-kLen=128 +BenchmarkKdfWithSM3/zLen=32-kLen=128-6 + 2514219 467.8 ns/op 128 B/op 1 allocs/op +BenchmarkKdfWithSM3/zLen=64-kLen=32 +BenchmarkKdfWithSM3/zLen=64-kLen=32-6 + 3024373 399.9 ns/op 32 B/op 1 allocs/op +BenchmarkKdfWithSM3/zLen=64-kLen=64 +BenchmarkKdfWithSM3/zLen=64-kLen=64-6 + 2027554 596.3 ns/op 64 B/op 1 allocs/op +BenchmarkKdfWithSM3/zLen=64-kLen=128 +BenchmarkKdfWithSM3/zLen=64-kLen=128-6 + 1744693 691.4 ns/op 128 B/op 1 allocs/op +BenchmarkKdfWithSM3/zLen=64-kLen=256 +BenchmarkKdfWithSM3/zLen=64-kLen=256-6 + 1397571 811.7 ns/op 256 B/op 1 allocs/op +BenchmarkKdfWithSM3/zLen=64-kLen=512 +BenchmarkKdfWithSM3/zLen=64-kLen=512-6 + 862700 1385 ns/op 512 B/op 1 allocs/op +BenchmarkKdfWithSM3/zLen=64-kLen=1024 +BenchmarkKdfWithSM3/zLen=64-kLen=1024-6 + 507590 2364 ns/op 1024 B/op 1 allocs/op +BenchmarkKdfWithSM3/zLen=64-kLen=8192 +BenchmarkKdfWithSM3/zLen=64-kLen=8192-6 + 70632 17524 ns/op 8192 B/op 1 allocs/op +``` +``` +goos: windows +goarch: amd64 +pkg: github.com/emmansun/gmsm/sm2 +cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz +BenchmarkEncrypt1K_SM2 +BenchmarkEncrypt1K_SM2-6 + 16662 72808 ns/op 14.06 MB/s 2856 B/op 13 allocs/op +BenchmarkEncrypt8K_SM2 +BenchmarkEncrypt8K_SM2-6 + 10861 111046 ns/op 73.77 MB/s 18344 B/op 13 allocs/op +BenchmarkEncrypt1M_SM2 +BenchmarkEncrypt1M_SM2-6 + 205 5856919 ns/op 179.03 MB/s 2106029 B/op 13 allocs/op +BenchmarkSM4CBCEncrypt1M +BenchmarkSM4CBCEncrypt1M-6 + 100 10017195 ns/op 104.68 MB/s 10489 B/op 0 allocs/op +``` +