MCPcopy Create free account
hub / github.com/cockroachdb/redact / BenchmarkRedactCall_HashEnabled

Function BenchmarkRedactCall_HashEnabled

bench_test.go:40–48  ·  view source on GitHub ↗

BenchmarkRedactCall_HashMarkers calls .Redact() on a string with ‹†...› hash markers and hashing enabled. This exercises the SHA-256 path.

(b *testing.B)

Source from the content-addressed store, hash-verified

38// BenchmarkRedactCall_HashMarkers calls .Redact() on a string with ‹†...›
39// hash markers and hashing enabled. This exercises the SHA-256 path.
40func BenchmarkRedactCall_HashEnabled(b *testing.B) {
41 EnableHashing(nil)
42 defer DisableHashing()
43 s := Sprintf("user=%s action=%s", HashString("alice"), SafeString("login"))
44 b.ResetTimer()
45 for i := 0; i < b.N; i++ {
46 _ = s.Redact()
47 }
48}
49
50// BenchmarkRedactCall_SingleHashWithSalt — 1 ‹†alice› marker, HMAC-SHA256.
51func BenchmarkRedactCall_HashWithSalt(b *testing.B) {

Callers

nothing calls this directly

Calls 6

HashStringTypeAlias · 0.85
SafeStringTypeAlias · 0.85
EnableHashingFunction · 0.70
DisableHashingFunction · 0.70
SprintfFunction · 0.70
RedactMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…