MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / hashFields

Function hashFields

pkg/filter/util.go:262–293  ·  view source on GitHub ↗

hashFields computes the hash of all field values.

(values []any)

Source from the content-addressed store, hash-verified

260
261// hashFields computes the hash of all field values.
262func hashFields(values []any) string {
263 buf := make([]byte, 0)
264 for _, v := range values {
265 switch val := v.(type) {
266 case uint8:
267 buf = append(buf, val)
268 case uint16:
269 buf = append(buf, bytes.WriteUint16(val)...)
270 case uint32:
271 buf = append(buf, bytes.WriteUint32(val)...)
272 case uint64:
273 buf = append(buf, bytes.WriteUint64(val)...)
274 case int8:
275 buf = append(buf, byte(val))
276 case int16:
277 buf = append(buf, bytes.WriteUint16(uint16(val))...)
278 case int32:
279 buf = append(buf, bytes.WriteUint32(uint32(val))...)
280 case int64:
281 buf = append(buf, bytes.WriteUint64(uint64(val))...)
282 case int:
283 buf = append(buf, bytes.WriteUint64(uint64(val))...)
284 case uint:
285 buf = append(buf, bytes.WriteUint64(uint64(val))...)
286 case string:
287 buf = append(buf, val...)
288 case net.IP:
289 buf = append(buf, val...)
290 }
291 }
292 return hex.EncodeToString(buf)
293}
294
295func joinsEqual(joins []bool) bool {
296 for _, j := range joins {

Callers 2

evalBoundSequenceMethod · 0.85
makeSequenceLinkIDFunction · 0.85

Calls 3

WriteUint16Function · 0.92
WriteUint32Function · 0.92
WriteUint64Function · 0.92

Tested by

no test coverage detected