| 1 |
root |
1.1 |
NAME |
| 2 |
root |
1.2 |
Strihng::CRC32C - Castagnoli CRC |
| 3 |
root |
1.1 |
|
| 4 |
|
|
SYNOPSIS |
| 5 |
root |
1.2 |
use String::CRC32C; # does not export anything by default |
| 6 |
|
|
use String::CRC32C 'crc32c'; |
| 7 |
|
|
|
| 8 |
|
|
$crc = crc32 "some string"; |
| 9 |
|
|
$crc = crc32 "some string", $initvalue; |
| 10 |
root |
1.1 |
|
| 11 |
|
|
DESCRIPTION |
| 12 |
root |
1.2 |
This module calculates the Castagnoli CRC32 variant (polynomial |
| 13 |
|
|
0x11EDC6F41). |
| 14 |
|
|
|
| 15 |
|
|
It is used by iSCSI, SCTP, BTRFS, ext4, leveldb, AMD64 CPUs and others. |
| 16 |
|
|
|
| 17 |
|
|
This module uses an optimized implementation for SSE 4.2 CPUs and the |
| 18 |
|
|
SlicingBy8 algorithm for anything else. |
| 19 |
|
|
|
| 20 |
|
|
$crc32c = crc32c $string[, $initvalue] |
| 21 |
|
|
Calculates the CRC32C value of the given $string and returns it as a |
| 22 |
|
|
32 bit unsigned integer. |
| 23 |
|
|
|
| 24 |
|
|
To get the common hex form, use one of: |
| 25 |
|
|
|
| 26 |
|
|
sprintf "%08x", crc32c $string |
| 27 |
|
|
unpack "H*", pack "L>", crc32c $string |
| 28 |
|
|
|
| 29 |
|
|
A seed/initial crc value can be given as second argument. Note that |
| 30 |
|
|
both the initial value and the result value are inverted |
| 31 |
|
|
(pre-inversion and post-inversion), e.g. a common init value of -1 |
| 32 |
|
|
from other descriptions needs to be given as 0 (or "~-1"). |
| 33 |
|
|
|
| 34 |
|
|
This allows easy chaining, e.g. |
| 35 |
|
|
|
| 36 |
|
|
(crc32c "abcdefghi") eq (crc32 "ghi", crc32 "def", crc32 "abc) |
| 37 |
root |
1.1 |
|
| 38 |
|
|
AUTHOR |
| 39 |
|
|
Marc Lehmann <schmorp@schmorp.de> |
| 40 |
|
|
http://home.schmorp.de/ |
| 41 |
|
|
|
| 42 |
root |
1.2 |
CRC32C code by various sources, ported from |
| 43 |
|
|
https://github.com/htot/crc32c, see sources for details. |
| 44 |
|
|
|