2
* IPRT - CRCs and Checksums.
6
* Copyright (C) 2006-2009 Sun Microsystems, Inc.
8
* This file is part of VirtualBox Open Source Edition (OSE), as
9
* available from http://www.virtualbox.org. This file is free software;
10
* you can redistribute it and/or modify it under the terms of the GNU
11
* General Public License (GPL) as published by the Free Software
12
* Foundation, in version 2 as it comes in the "COPYING" file of the
13
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16
* The contents of this file may alternatively be used under the terms
17
* of the Common Development and Distribution License Version 1.0
18
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19
* VirtualBox OSE distribution, in which case the provisions of the
20
* CDDL are applicable instead of those of the GPL.
22
* You may elect to license modified versions of this file under the
23
* terms and conditions of either the GPL or the CDDL or both.
25
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26
* Clara, CA 95054 USA or visit http://www.sun.com if you need
27
* additional information or have any questions.
33
#include <iprt/cdefs.h>
34
#include <iprt/types.h>
39
/** @defgroup grp_rt_crc RTCrc - Checksums and CRCs.
45
/** @defgroup grp_rt_crc32 CRC-32
48
* Calculate CRC-32 for a memory block.
50
* @returns CRC-32 for the memory block.
51
* @param pv Pointer to the memory block.
52
* @param cb Size of the memory block in bytes.
54
RTDECL(uint32_t) RTCrc32(const void *pv, size_t cb);
57
* Start a multiblock CRC-32 calculation.
59
* @returns Start CRC-32.
61
RTDECL(uint32_t) RTCrc32Start(void);
64
* Processes a multiblock of a CRC-32 calculation.
66
* @returns Intermediate CRC-32 value.
67
* @param uCRC32 Current CRC-32 intermediate value.
68
* @param pv The data block to process.
69
* @param cb The size of the data block in bytes.
71
RTDECL(uint32_t) RTCrc32Process(uint32_t uCRC32, const void *pv, size_t cb);
74
* Complete a multiblock CRC-32 calculation.
76
* @returns CRC-32 value.
77
* @param uCRC32 Current CRC-32 intermediate value.
79
RTDECL(uint32_t) RTCrc32Finish(uint32_t uCRC32);
83
/** @defgroup grp_rt_crc64 CRC-64 Calculation
86
* Calculate CRC-64 for a memory block.
88
* @returns CRC-64 for the memory block.
89
* @param pv Pointer to the memory block.
90
* @param cb Size of the memory block in bytes.
92
RTDECL(uint64_t) RTCrc64(const void *pv, size_t cb);
95
* Start a multiblock CRC-64 calculation.
97
* @returns Start CRC-64.
99
RTDECL(uint64_t) RTCrc64Start(void);
102
* Processes a multiblock of a CRC-64 calculation.
104
* @returns Intermediate CRC-64 value.
105
* @param uCRC64 Current CRC-64 intermediate value.
106
* @param pv The data block to process.
107
* @param cb The size of the data block in bytes.
109
RTDECL(uint64_t) RTCrc64Process(uint64_t uCRC64, const void *pv, size_t cb);
112
* Complete a multiblock CRC-64 calculation.
114
* @returns CRC-64 value.
115
* @param uCRC64 Current CRC-64 intermediate value.
117
RTDECL(uint64_t) RTCrc64Finish(uint64_t uCRC64);
121
/** @defgroup grp_rt_crc_adler32 Adler-32
124
* Calculate Adler-32 for a memory block.
126
* @returns Adler-32 for the memory block.
127
* @param pv Pointer to the memory block.
128
* @param cb Size of the memory block in bytes.
130
RTDECL(uint32_t) RTCrcAdler32(void const *pv, size_t cb);
133
* Start a multiblock Adler-32 calculation.
135
* @returns Start Adler-32.
137
RTDECL(uint32_t) RTCrcAdler32Start(void);
140
* Processes a multiblock of a Adler-32 calculation.
142
* @returns Intermediate Adler-32 value.
143
* @param uCrc Current Adler-32 intermediate value.
144
* @param pv The data block to process.
145
* @param cb The size of the data block in bytes.
147
RTDECL(uint32_t) RTCrcAdler32Process(uint32_t uCrc, void const *pv, size_t cb);
150
* Complete a multiblock Adler-32 calculation.
152
* @returns Adler-32 value.
153
* @param uCrc Current Adler-32 intermediate value.
155
RTDECL(uint32_t) RTCrcAdler32Finish(uint32_t uCrc);