github.phpd.cn/hashicorp/packer@v1.3.2/builder/azure/pkcs12/rc2/bench_test.go (about)

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package rc2
     6  
     7  import (
     8  	"testing"
     9  )
    10  
    11  func BenchmarkEncrypt(b *testing.B) {
    12  	r, _ := New([]byte{0, 0, 0, 0, 0, 0, 0, 0}, 64)
    13  	b.ResetTimer()
    14  	var src [8]byte
    15  	for i := 0; i < b.N; i++ {
    16  		r.Encrypt(src[:], src[:])
    17  	}
    18  }
    19  
    20  func BenchmarkDecrypt(b *testing.B) {
    21  	r, _ := New([]byte{0, 0, 0, 0, 0, 0, 0, 0}, 64)
    22  	b.ResetTimer()
    23  	var src [8]byte
    24  	for i := 0; i < b.N; i++ {
    25  		r.Decrypt(src[:], src[:])
    26  	}
    27  }