github.com/scottcagno/storage@v1.8.0/pkg/util/checksum.go (about) 1 package util 2 3 import ( 4 "hash/crc32" 5 "hash/crc64" 6 ) 7 8 const defaultCRC32Poly = 0xeb31d82e // Koopman's polynomial 9 10 var defaultCRC32Table = crc32.MakeTable(defaultCRC32Poly) 11 12 func ChecksumCRC32(data []byte) uint32 { 13 return crc32.Checksum(data, crc32.MakeTable(crc32.Koopman)) 14 } 15 16 func ChecksumCRC64(data []byte) uint64 { 17 return crc64.Checksum(data, crc64.MakeTable(crc64.ECMA)) 18 }