bench_test.go 559 B

123456789101112131415161718192021222324252627
  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. package rc2
  5. import (
  6. "testing"
  7. )
  8. func BenchmarkEncrypt(b *testing.B) {
  9. r, _ := New([]byte{0, 0, 0, 0, 0, 0, 0, 0}, 64)
  10. b.ResetTimer()
  11. var src [8]byte
  12. for i := 0; i < b.N; i++ {
  13. r.Encrypt(src[:], src[:])
  14. }
  15. }
  16. func BenchmarkDecrypt(b *testing.B) {
  17. r, _ := New([]byte{0, 0, 0, 0, 0, 0, 0, 0}, 64)
  18. b.ResetTimer()
  19. var src [8]byte
  20. for i := 0; i < b.N; i++ {
  21. r.Decrypt(src[:], src[:])
  22. }
  23. }