ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/String-CRC32C/README
Revision: 1.3
Committed: Sat Mar 29 03:23:23 2025 UTC (18 months ago) by root
Branch: MAIN
Changes since 1.2: +8 -2 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 NAME
2 Strihng::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 $impl = $String::CRC32C::IMPL
40 Returns 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 AUTHOR
45 Marc Lehmann <schmorp@schmorp.de>
46 http://home.schmorp.de/
47
48 CRC32C code by various sources, ported from
49 https://github.com/htot/crc32c, see sources for details.
50