## Reference
* Information security technology—ZUC stream cipher algorithm—Part 1: Algorithm description 《GB/T 33133.1-2016 信息安全技术 祖冲之序列密码算法 第1部分：算法描述》
* Information security technology—ZUC stream cipher algorithm—Part 2: Confidentiality algorithm 《GB/T 33133.2-2021 信息安全技术 祖冲之序列密码算法 第2部分：保密性算法》
* Information security technology—ZUC stream cipher algorithm—Part 3: Integrity algorithm 《GB/T 33133.3-2021 信息安全技术 祖冲之序列密码算法 第3部分：完整性算法》

您可以从[国家标准全文公开系统](https://openstd.samr.gov.cn/)在线阅读这些标准。

## ZUC original performance:

    goos: windows
    goarch: amd64
    pkg: github.com/emmansun/gmsm/zuc
    cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
    BenchmarkEncrypt1K-6   	   30052	     39131 ns/op	  26.04 MB/s
    BenchmarkEncrypt8K-6   	    3853	    310722 ns/op	  26.35 MB/s

## Performance after delay mod & lfsr array copy:

    goos: windows
    goarch: amd64
    pkg: github.com/emmansun/gmsm/zuc
    cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
    BenchmarkEncrypt1K-6   	   41754	     26916 ns/op	  37.86 MB/s
    BenchmarkEncrypt8K-6   	    5290	    215252 ns/op	  38.03 MB/s

## Performance after delay mod & lfsr array copy & merge sbox0/sbox1 (sbox size from 0.5k to 128k, so i do not commit it):
    goos: windows
    goarch: amd64
    pkg: github.com/emmansun/gmsm/zuc
    cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
    BenchmarkEncrypt1K-6   	   49195	     23710 ns/op	  42.98 MB/s
    BenchmarkEncrypt8K-6   	    6000	    191255 ns/op	  42.81 MB/s

```go
func (s *zucState32) f32(x0, x1, x2 uint32) uint32 {
	w := s.r1 ^ x0 + s.r2
	w1 := s.r1 + x1
	w2 := s.r2 ^ x2
	u := l1((w1 << 16) | (w2 >> 16))
	v := l2((w2 << 16) | (w1 >> 16))
	s.r1 = uint32(bigSbox[u>>16])<<16 | uint32(bigSbox[u&0xFFFF])
	s.r2 = uint32(bigSbox[v>>16])<<16 | uint32(bigSbox[v&0xFFFF])
	return w
}

// bigSbox is generated by 
	for i := 0; i < 256; i++ {
		for j := 0; j < 256; j++ {
			if (j > 0 || i > 0) && j%16 == 0 {
				fmt.Println()
			}
			fmt.Printf("0x%04x,", uint16(sbox0[i])<<8|uint16(sbox1[j]))
		}
	}
	fmt.Println()
```

## EEA Performance with AMD64 SIMD & AESNI:
    goos: windows
    goarch: amd64
    pkg: github.com/emmansun/gmsm/zuc
    cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
    BenchmarkEncrypt1K-6   	  409755	      2802 ns/op	 363.62 MB/s
    BenchmarkEncrypt8K-6   	   54120	     22413 ns/op	 365.28 MB/s

## EIA Performance with AMD64 SIMD & AESNI & CLMUL:
    goos: windows
    goarch: amd64
    pkg: github.com/emmansun/gmsm/zuc
    cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
    BenchmarkHash1K-6   	  317750	      3833 ns/op	 267.13 MB/s
    BenchmarkHash8K-6   	   40460	     28921 ns/op	 283.26 MB/s
    BenchmarkHash1K_Tag64-6   	  302163	      3979 ns/op	 257.34 MB/s
    BenchmarkHash8K_Tag64-6   	   39210	     30859 ns/op	 265.46 MB/s
    BenchmarkHash1K_Tag128-6   	  279069	      4134 ns/op	 247.70 MB/s
    BenchmarkHash8K_Tag128-6   	   38238	     31395 ns/op	 260.93 MB/s

