func (c *crc32Field) check(curOffset int, buf []byte) error { crc := crc32.ChecksumIEEE(buf[c.startOffset+4 : curOffset]) if crc != binary.BigEndian.Uint32(buf[c.startOffset:]) { return PacketDecodingError{"CRC didn't match"} } return nil }
func (c *crc32Field) run(curOffset int, buf []byte) error { crc := crc32.ChecksumIEEE(buf[c.startOffset+4 : curOffset]) binary.BigEndian.PutUint32(buf[c.startOffset:], crc) return nil }