ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/String-CRC32C/README
Revision: 1.4
Committed: Sun Mar 30 12:41:50 2025 UTC (17 months, 2 weeks ago) by root
Branch: MAIN
CVS Tags: rel-1_0, HEAD
Changes since 1.3: +11 -4 lines
Log Message:
1.0

File Contents

# Content
1 NAME
2 String::CRC32C - Castagnoli CRC
3
4 SYNOPSIS
5 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
11 DESCRIPTION
12 This module calculates the Castagnoli CRC32 variant (polynomial
13 0x11EDC6F41).
14
15 It is used by iSCSI, SCTP, BTRFS, ext4, leveldb, x86 CPUs and others.
16
17 This module uses an optimized implementation for SSE 4.2 targets (GCC
18 and compatible supported, SSE 4.2 must be enabled in your Perl) and the
19 SlicingBy8 algorithm for anything else.
20
21 $crc32c = crc32c $string[, $initvalue]
22 Calculates the CRC32C value of the given $string and returns it as a
23 32 bit unsigned integer.
24
25 To get the common hex form, use one of:
26
27 sprintf "%08x", crc32c $string
28 unpack "H*", pack "L>", crc32c $string
29
30 A seed/initial crc value can be given as second argument. Note that
31 both the initial value and the result value are inverted
32 (pre-inversion and post-inversion), e.g. a common init value of -1
33 from other descriptions needs to be given as 0 (or "~-1").
34
35 This allows easy chaining, e.g.
36
37 (crc32c "abcdefghi") eq (crc32 "ghi", crc32 "def", crc32 "abc")
38
39 $String::CRC32C::IMPL
40 Contains a string indicating the implementation that will be used.
41 Currently either "SlicingBy8" for the portable implementation or
42 "IntelCSSE42" for the SSE 4.2 optimized intel version.
43
44 PERLMULTICORE SUPPORT
45 This module supports the perl multicore spoecification
46 (<http://perlmulticore.schmorp.de/>): the "crc32c" function will
47 relinquish the current thread for crc32c lengths larger than 64k (the
48 break-even point on my machine is around 128k), so multiprocessing makes
49 only sense for very long blocks.
50
51 AUTHOR
52 Marc Lehmann <schmorp@schmorp.de>
53 http://home.schmorp.de/
54
55 CRC32C code by various sources, ported from
56 https://github.com/htot/crc32c, see sources for details.
57