MCPcopy Create free account
hub / github.com/dgrr/http2 / AddPadding

Function AddPadding

http2utils/utils.go:89–101  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

87}
88
89func AddPadding(b []byte) []byte {
90 n := int(fastrand.Uint32n(256-9)) + 9
91 nn := len(b)
92
93 b = Resize(b, nn+n)
94 b = append(b[:1], b...)
95
96 b[0] = uint8(n)
97
98 _, _ = rand.Read(b[nn+1 : nn+n])
99
100 return b
101}
102
103func FastBytesToString(b []byte) string {
104 return *(*string)(unsafe.Pointer(&b))

Callers 2

SerializeMethod · 0.92
SerializeMethod · 0.92

Calls 2

ResizeFunction · 0.85
ReadMethod · 0.80

Tested by

no test coverage detected