git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/crypto/zeroize_test.go (about) 1 package crypto 2 3 import ( 4 "testing" 5 ) 6 7 func TestZeroize(t *testing.T) { 8 buffer := []byte("random buffer") 9 10 Zeroize(buffer) 11 12 for i := range buffer { 13 if buffer[i] != 0 { 14 t.Errorf("buffer not zeroized (index %d)", i) 15 } 16 } 17 } 18 19 func TestZeroizeNil(t *testing.T) { 20 // must not panic 21 Zeroize(nil) 22 }