func ProcessCRC() (uint32, error) { fh, err := os.Open("/proc/self/exe") if err != nil { return 0, err } defer fh.Close() c := crc.InitialCRC _, err = io.Copy(writerFunc(func(p []byte) (n int, err error) { c = crc.CRC(c, p) return len(p), nil }), fh) if err != nil { return 0, err } return c, nil }
// FloatHash CRCs a byte array and converts the CRC into a float64, for easier // datapoint usage. func FloatHash(data []byte) float64 { return float64(crc.CRC(crc.InitialCRC, data)) }