MCPcopy Create free account
hub / github.com/dank/rlapi / crc32

Function crc32

buildid.go:12–26  ·  view source on GitHub ↗

crc32 computes the non-reflected (big-endian) CRC-32

(data []byte, seed uint32)

Source from the content-addressed store, hash-verified

10
11// crc32 computes the non-reflected (big-endian) CRC-32
12func crc32(data []byte, seed uint32) int32 {
13 const poly = uint32(0x04C11DB7)
14 crc := seed ^ 0xFFFF_FFFF
15 for _, b := range data {
16 crc ^= uint32(b) << 24
17 for range 8 {
18 if crc&0x8000_0000 != 0 {
19 crc = (crc << 1) ^ poly
20 } else {
21 crc <<= 1
22 }
23 }
24 }
25 return int32(crc ^ 0xFFFF_FFFF)
26}

Callers 1

decodeBuildIDFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected