EvilCrc32c (evil_crc32c v0.2.5)
"Evil" versions of the crc32c and crc16 algorithm. It uses the bitwise arithmetic used in javascript, i.e. operands are converted to i32
Link to this section Summary
Functions
Calculate the CRC16.
Calculate the CRC32C.
Calculate the CRC32C. Raises an Argument error if data is not binary
Link to this section Functions
Link to this function
crc16(data)
Calculate the CRC16.
Examples
iex> EvilCrc32c.crc16("abcdef")
<<58, 253>>
Link to this function
crc32c(data, binary \\ true)
Calculate the CRC32C.
Examples
iex> EvilCrc32c.crc32c(<<1, 2, 3, 4>>)
{:ok, <<244, 140, 48, 41>>}
iex> EvilCrc32c.crc32c(5)
{:error, :not_binary_data}
iex> EvilCrc32c.crc32c("hello", false)
{:ok, -1703822516}
iex> EvilCrc32c.crc32c("hello", true)
{:ok, <<76, 187, 113, 154>>}
Link to this function
crc32c!(data, binary \\ true)
Calculate the CRC32C. Raises an Argument error if data is not binary
Examples
iex> EvilCrc32c.crc32c!(<<1, 2, 3, 4>>)
<<244, 140, 48, 41>>
iex> EvilCrc32c.crc32c!("hello", false)
-1703822516
iex> EvilCrc32c.crc32c!("hello", true)
<<76, 187, 113, 154>>