summary refs log tree commit diff homepage
path: root/crc32.3
blob: 3c9cc8c4213b7e10b56951222195196648124be6 (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 C. 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
>Christian Hesse 2015-08-13Makefile: make "git/config.mak.uname" inclusion optionalJohn Keeping 2015-08-13ui-shared: show full date in tooltip if longer ago than max_relativeJohn Keeping 2015-08-13ui-shared: use common function in print_rel_date()John Keeping 2015-08-13ui-shared: extract date formatting to a functionJohn Keeping 2015-08-13filter: don't use dlsym unnecessarilyJohn Keeping 2015-08-13ui-tree: use "sane" isgraph()John Keeping 2015-08-13cgit.h: move stdbool.h from ui-shared.hJohn Keeping 2015-08-13cache.c: fix header orderJohn Keeping 2015-08-13configfile.c: don't include system headers directlyJohn Keeping 2015-08-13Remove redundant includesJohn Keeping 2015-08-13Makefile: include Git's config.mak.unameJohn Keeping 2015-08-13tests: allow shell to be overriddenJohn Keeping 2015-08-13redirect: cleanlinessJason A. Donenfeld 2015-08-13redirect: be more careful for different cgi setupsJason A. Donenfeld 2015-08-12ui-log: fix double countingJohn Keeping 2015-08-12log: allow users to follow a fileJohn Keeping 2015-08-12shared: make cgit_diff_tree_cb publicJohn Keeping 2015-08-12t0110: Chain together using &&Jason A. Donenfeld 2015-08-12about: always ensure page has a trailing slashJason A. Donenfeld 2015-08-12filters: apply HTML escapingLazaros Koromilas 2015-08-12git: update to v2.5.0Christian Hesse 2015-08-12Fix processing of repo.hide and repo.ignoreDaniel Reichelt