module

Filament::Native

Constants

CRC32_TABLE = begin tab = StaticArray(UInt32, 256).new(0_u32) 256.times do |i| crc = i.to_u32 8.times do if (crc & 1_u32) != 0_u32 crc = (crc >> 1) ^ 3988292384_u32 else crc = crc >> 1 end end tab[i] = crc end tab end

Precomputed CRC32 table for IEEE 802.3 Ethernet polynomial

Class methods

bytes_to_hex(data : Bytes) : String

Converts raw bytes into hex string

Source
checksum16(data : Bytes) : UInt16

Computes RFC 1071 16-bit Internet checksum

Source
crc32(data : Bytes) : UInt32

Computes IEEE 802.3 CRC32

Source
verify_checksum16(data : Bytes) : Bool

Verifies if checksum over buffer is valid (should equal 0)

Source