github.com/emmansun/gmsm@v0.29.1/zuc/README.md (about) 1 ## Reference 2 * Information security technology—ZUC stream cipher algorithm—Part 1: Algorithm description 《GB/T 33133.1-2016 信息安全技术 祖冲之序列密码算法 第1部分:算法描述》 3 * Information security technology—ZUC stream cipher algorithm—Part 2: Confidentiality algorithm 《GB/T 33133.2-2021 信息安全技术 祖冲之序列密码算法 第2部分:保密性算法》 4 * Information security technology—ZUC stream cipher algorithm—Part 3: Integrity algorithm 《GB/T 33133.3-2021 信息安全技术 祖冲之序列密码算法 第3部分:完整性算法》 5 6 您可以从[国家标准全文公开系统](https://openstd.samr.gov.cn/)在线阅读这些标准。 7 8 ## ZUC original performance: 9 10 goos: windows 11 goarch: amd64 12 pkg: github.com/emmansun/gmsm/zuc 13 cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz 14 BenchmarkEncrypt1K-6 30052 39131 ns/op 26.04 MB/s 15 BenchmarkEncrypt8K-6 3853 310722 ns/op 26.35 MB/s 16 17 ## Performance after delay mod & lfsr array copy: 18 19 goos: windows 20 goarch: amd64 21 pkg: github.com/emmansun/gmsm/zuc 22 cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz 23 BenchmarkEncrypt1K-6 41754 26916 ns/op 37.86 MB/s 24 BenchmarkEncrypt8K-6 5290 215252 ns/op 38.03 MB/s 25 26 ## Performance after delay mod & lfsr array copy & merge sbox0/sbox1 (sbox size from 0.5k to 128k, so i do not commit it): 27 goos: windows 28 goarch: amd64 29 pkg: github.com/emmansun/gmsm/zuc 30 cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz 31 BenchmarkEncrypt1K-6 49195 23710 ns/op 42.98 MB/s 32 BenchmarkEncrypt8K-6 6000 191255 ns/op 42.81 MB/s 33 34 ```go 35 func (s *zucState32) f32(x0, x1, x2 uint32) uint32 { 36 w := s.r1 ^ x0 + s.r2 37 w1 := s.r1 + x1 38 w2 := s.r2 ^ x2 39 u := l1((w1 << 16) | (w2 >> 16)) 40 v := l2((w2 << 16) | (w1 >> 16)) 41 s.r1 = uint32(bigSbox[u>>16])<<16 | uint32(bigSbox[u&0xFFFF]) 42 s.r2 = uint32(bigSbox[v>>16])<<16 | uint32(bigSbox[v&0xFFFF]) 43 return w 44 } 45 46 // bigSbox is generated by 47 for i := 0; i < 256; i++ { 48 for j := 0; j < 256; j++ { 49 if (j > 0 || i > 0) && j%16 == 0 { 50 fmt.Println() 51 } 52 fmt.Printf("0x%04x,", uint16(sbox0[i])<<8|uint16(sbox1[j])) 53 } 54 } 55 fmt.Println() 56 ``` 57 58 ## EEA Performance with AMD64 SIMD & AESNI: 59 goos: windows 60 goarch: amd64 61 pkg: github.com/emmansun/gmsm/zuc 62 cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz 63 BenchmarkEncrypt1K-6 409755 2802 ns/op 363.62 MB/s 64 BenchmarkEncrypt8K-6 54120 22413 ns/op 365.28 MB/s 65 66 ## EIA Performance with AMD64 SIMD & AESNI & CLMUL: 67 goos: windows 68 goarch: amd64 69 pkg: github.com/emmansun/gmsm/zuc 70 cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz 71 BenchmarkHash1K-6 317750 3833 ns/op 267.13 MB/s 72 BenchmarkHash8K-6 40460 28921 ns/op 283.26 MB/s 73 BenchmarkHash1K_Tag64-6 302163 3979 ns/op 257.34 MB/s 74 BenchmarkHash8K_Tag64-6 39210 30859 ns/op 265.46 MB/s 75 BenchmarkHash1K_Tag128-6 279069 4134 ns/op 247.70 MB/s 76 BenchmarkHash8K_Tag128-6 38238 31395 ns/op 260.93 MB/s 77