Categorygithub.com/need-being/gmcrypto
repository
0.3.1
Repository: https://github.com/need-being/gmcrypto.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

gmcrypto

Go Reference

Golang crypto library based on Chinese National Standard

SM2 - Signature Algorithm

The algorithm is defined by GB/T 32918.1-2016, GB/T 32918.2-2016, and GB/T 32918.5-2017.

The gmcrypto/sm2 package implements

Performance

This implementation: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz

OperationSpeedAllocated MemMem Allocs
Sign1592825 ns/op871452 B/op9294 allocs/op
Verify3211443 ns/op1724630 B/op18393 allocs/op
VerifyFailed3149854 ns/op1695985 B/op18101 allocs/op

This implementation with elliptic curve implementation github.com/tjfoc/gmsm/sm2.P256Sm2:

OperationSpeedAllocated MemMem Allocs
Sign249129 ns/op4021 B/op73 allocs/op
Verify1389493 ns/op82216 B/op1679 allocs/op
VerifyFailed1353205 ns/op77877 B/op1593 allocs/op

Other implementation: github.com/tjfoc/gmsm/sm2

OperationSpeedAllocated MemMem Allocs
Sign276723 ns/op4613 B/op90 allocs/op
Verify1503850 ns/op84577 B/op1738 allocs/op
VerifyFailed1522215 ns/op75034 B/op1537 allocs/op

SM3 - Cryptographic Hash Algorithm

The algorithm is defined by GB/T 32905-2016.

The gmcrypto/sm3 package implements

Performance

This implementation: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz

Content SizeSpeedThroughputAllocated MemMem Allocs
8 Bytes453.5 ns/op17.64 MB/s176 B/op2 allocs/op
320 Bytes2220 ns/op144.11 MB/s176 B/op2 allocs/op
1 KiB6079 ns/op168.44 MB/s176 B/op2 allocs/op
8 KiB45115 ns/op181.58 MB/s176 B/op2 allocs/op

Other implementation: github.com/tjfoc/gmsm/sm3

Content SizeSpeedThroughputAllocated MemMem Allocs
8 Bytes711.6 ns/op11.24 MB/s120 B/op4 allocs/op
320 Bytes3243 ns/op98.66 MB/s440 B/op5 allocs/op
1 KiB8393 ns/op122.01 MB/s1144 B/op5 allocs/op
8 KiB62547 ns/op130.97 MB/s8312 B/op5 allocs/op

SM4 - Block Cipher Algorithm

The algorithm is defined by GB/T 32907-2016.

The gmcrypto/sm4 package implements

  • crypto/cipher.Block, which can be further used in GCM, CBC, CFB, CTR, OFB, and many other block cipher modes.

Performance

This implementation: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz

OperationSpeedThroughputAllocated MemMem Allocs
NewCipher181.6 ns/op-128 B/op1 allocs/op
Encrypt131.4 ns/op121.77 MB/s0 B/op0 allocs/op
Decrypt134.4 ns/op119.08 MB/s0 B/op0 allocs/op

Other implementation: github.com/tjfoc/gmsm/sm4

OperationSpeedThroughputAllocated MemMem Allocs
NewCipher324.8 ns/op-240 B/op4 allocs/op
Encrypt146.4 ns/op109.32 MB/s0 B/op0 allocs/op
Decrypt148.1 ns/op108.04 MB/s0 B/op0 allocs/op