summary refs log tree commit diff
path: root/doc/zlib/crc32.3
blob: a42df2afbd535f7e92ce14e76b50f866679fdf42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.Dd January 15, 2017
.Dt CRC32 3
.Os
.
.Sh NAME
.Nm crc32 ,
.Nm crc32_z
.Nd update CRC-32 checksum
.
.Sh LIBRARY
.Lb libz
.
.Sh SYNOPSIS
.In zlib.h
.Ft uLong
.Fn crc32 "uLong crc" "const Bytef *buf" "uInt len"
.Ft uLong
.Fn crc32_z "uLong crc" "const Bytef *buf" "z_size_t len"
.
.Sh DESCRIPTION
Update a running CRC-32 with the bytes
.Fa "buf[0..len-1]"
and return the updated CRC-32.
If
.Fa buf
is
.Dv Z_NULL ,
this function returns
the required initial value for the CRC.
Pre- and post-conditioning
(one's complement)
is performed within this function
so it shouldn't be done
by the application.
.
.Pp
.Fn crc32_z
is the same as
.Fn crc32 ,
but with a
.Vt size_t
length.
.
.Sh EXAMPLES
.Bd -literal -offset indent
uLong crc = crc32(0L, Z_NULL, 0);

while (read_buffer(buffer, length) != EOF) {
	crc = crc32(crc, buffer, length);
}
if (crc != original_crc) error();
.Ed
.
.Sh SEE ALSO
.Xr adler32 3 ,
.Xr crc32_combine 3
.
.Sh HISTORY
This manual page was converted from
.In zlib.h
to mdoc format by
.An June McEnroe Aq Mt june@causal.agency .
.
.Sh AUTHORS
.An Jean-loup Gailly Aq Mt jloup@gzip.org
.An Mark Adler Aq Mt madler@alumni.caltech.edu
/tr> 2020-02-12Link to cgit /about pages where appropriateJune McEnroe 2020-02-11Separate LINKS from BINS for html to workJune McEnroe 2020-02-11Add margin to Bl-bullet itemsJune McEnroe 2020-02-10Match URLs inside parens or with paired parens insideJune McEnroe 2020-02-10Duplicate effective URL before passing it back to curlJune McEnroe Apparently sometimes it didn't like receiving its own internal storage to parse again. Understandable. 2020-02-09Add To Be Taught, If FortunateJune McEnroe 2020-02-04Add The Future of Another TimelineJune McEnroe Wow. One of the best I've read. 2020-01-31Reorganize the Makefile for the umpteenth timeJune McEnroe Broke out LDLIBS for each bin, and made everything more uniform. 2020-01-28Change scout sensitivity to 1.4June McEnroe idk it seems to work. 2020-01-28Import shows.txtJune McEnroe