mirror of
https://github.com/emmansun/gmsm.git
synced 2025-05-11 03:26:17 +08:00
Updated SM2加解密性能 (markdown)
parent
09fed5fed4
commit
bc12e329c5
29
SM2加解密性能.md
29
SM2加解密性能.md
@ -1 +1,28 @@
|
||||
//TODO
|
||||
# SM2加密性能分析
|
||||

|
||||
|
||||
按SM2加密算法流程来看,
|
||||
* 第1、2、3、4步属于SM2椭圆曲线计算;
|
||||
* 第5步是KDF操作,其主要也是SM3哈希计算;
|
||||
* 第6步是异或操作;
|
||||
* 第7步是SM3哈希计算;
|
||||
|
||||
SM2加密的性能主要是由上述7步计算共同决定的,关于SM2椭圆曲线计算,这里不作讨论。第6步异或操作,相对最简单、耗时也最少。第7步SM3哈希计算,其耗时随待加密数据长度增加而增加。我们来看看性能数据:
|
||||
|
||||
**SM2加密(明文长度不超过32字节,使第5-7步影响最小)**:
|
||||
```
|
||||
goos: windows
|
||||
goarch: amd64
|
||||
pkg: github.com/emmansun/gmsm/sm2
|
||||
cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
|
||||
BenchmarkLessThan32_SM2
|
||||
BenchmarkLessThan32_SM2-6
|
||||
17731 67668 ns/op 712 B/op 12 allocs/op
|
||||
```
|
||||
|
||||
**第5步KDF**:
|
||||
```
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user