2014-10-30 03:32:09 -07:00
|
|
|
package common
|
|
|
|
|
2015-03-16 02:23:35 -07:00
|
|
|
func Fingerprint(slice []byte) []byte {
|
2014-10-30 03:32:09 -07:00
|
|
|
fingerprint := make([]byte, 6)
|
2015-03-16 02:23:35 -07:00
|
|
|
copy(fingerprint, slice)
|
2014-10-30 03:32:09 -07:00
|
|
|
return fingerprint
|
|
|
|
}
|
2015-03-16 02:23:35 -07:00
|
|
|
|
|
|
|
func RightPadBytes(slice []byte, l int) []byte {
|
|
|
|
if l < len(slice) {
|
|
|
|
return slice
|
|
|
|
}
|
|
|
|
padded := make([]byte, l)
|
|
|
|
copy(padded[0:len(slice)], slice)
|
|
|
|
return padded
|
|
|
|
}
|
|
|
|
|
|
|
|
func LeftPadBytes(slice []byte, l int) []byte {
|
|
|
|
if l < len(slice) {
|
|
|
|
return slice
|
|
|
|
}
|
|
|
|
padded := make([]byte, l)
|
|
|
|
copy(padded[l-len(slice):], slice)
|
|
|
|
return padded
|
|
|
|
}
|