7 // Fingerprint returns the first 6 bytes of a byte slice.
8 // If the slice is less than 6 bytes, the fingerprint
9 // contains trailing zeroes.
10 func Fingerprint(slice []byte) []byte {
11 fingerprint := make([]byte, 6)
12 copy(fingerprint, slice)
16 func IsZeros(slice []byte) bool {
17 for _, byt := range slice {
25 func RightPadBytes(slice []byte, l int) []byte {
29 padded := make([]byte, l)
30 copy(padded[0:len(slice)], slice)
34 func LeftPadBytes(slice []byte, l int) []byte {
38 padded := make([]byte, l)
39 copy(padded[l-len(slice):], slice)
43 func TrimmedString(b []byte) string {
44 trimSet := string([]byte{0})
45 return string(bytes.TrimLeft(b, trimSet))