github.com/emmansun/gmsm@v0.29.1/cipher/xts_tweak_test.go (about)

     1  package cipher
     2  
     3  import (
     4  	"crypto/aes"
     5  	"testing"
     6  )
     7  
     8  func BenchmarkDoubleTweak(b *testing.B) {
     9  	var tweak [16]byte
    10  	block, err := aes.NewCipher(make([]byte, 16))
    11  	if err != nil {
    12  		b.Failed()
    13  	}
    14  	block.Encrypt(tweak[:], tweak[:])
    15  
    16  	b.ResetTimer()
    17  	for i := 0; i < b.N; i++ {
    18  		mul2(&tweak, false)
    19  	}
    20  }