Debian Codegraph @

src/crypto/internal/fips140/drbg/rand_test.go

raw
1 // Copyright 2025 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 drbg
6
7 import (
8 "crypto/internal/fips140"
9 "testing"
10 )
11
12 func BenchmarkDBRG(b *testing.B) {
13 old := fips140.Enabled
14 defer func() {
15 fips140.Enabled = old
16 }()
17 fips140.Enabled = true
18
19 const N = 64
20 b.SetBytes(N)
21 b.RunParallel(func(pb *testing.PB) {
22 buf := make([]byte, N)
23 for pb.Next() {
24 Read(buf)
25 }
26 })
27 }