excrc32c
View SourceA pure Elixir implementation of CRC32C.
Code is copied from here and distributed as a package on Hex.pm
All credit goes to the original author(s):
Installation
The package can be installedby adding excrc32c
to your list of dependencies in mix.exs
:
def deps do
[
{:excrc32c, "~> 0.1.0"}
]
end
Usage
iex> Excrc32c.crc32c("123456789")
3808858755
iex> Excrc32c.crc32c("DYB|O")
0
Performance
Tested using benchee
against crc32cer
(NIF):
Name ips average deviation median 99th %
nif 3.11 K 0.32 ms ±33.60% 0.31 ms 0.51 ms
elixir 0.130 K 7.69 ms ±1.92% 7.68 ms 8.24 ms
Comparison:
nif 3.11 K
elixir 0.130 K - 23.90x slower +7.37 ms