1 | /** @file
|
---|
2 | * IPRT - CRC32.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
7 | *
|
---|
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.
|
---|
15 | *
|
---|
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.
|
---|
21 | *
|
---|
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.
|
---|
24 | *
|
---|
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.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef ___iprt_crc32_h
|
---|
31 | #define ___iprt_crc32_h
|
---|
32 |
|
---|
33 | #include <iprt/cdefs.h>
|
---|
34 | #include <iprt/types.h>
|
---|
35 |
|
---|
36 |
|
---|
37 | __BEGIN_DECLS
|
---|
38 |
|
---|
39 | /** @defgroup grp_rt_crc32 RTCrc32 - CRC32 Calculation
|
---|
40 | * @ingroup grp_rt
|
---|
41 | * @{
|
---|
42 | */
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * Calculate CRC32 for a memory block.
|
---|
46 | *
|
---|
47 | * @returns CRC32 for the memory block.
|
---|
48 | * @param pv Pointer to the memory block.
|
---|
49 | * @param cb Size of the memory block in bytes.
|
---|
50 | */
|
---|
51 | RTDECL(uint32_t) RTCrc32(const void *pv, size_t cb);
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * Start a multiblock CRC32 calculation.
|
---|
55 | *
|
---|
56 | * @returns Start CRC32.
|
---|
57 | */
|
---|
58 | RTDECL(uint32_t) RTCrc32Start(void);
|
---|
59 |
|
---|
60 | /**
|
---|
61 | * Processes a multiblock of a CRC32 calculation.
|
---|
62 | *
|
---|
63 | * @returns Intermediate CRC32 value.
|
---|
64 | * @param uCRC32 Current CRC32 intermediate value.
|
---|
65 | * @param pv The data block to process.
|
---|
66 | * @param cb The size of the data block in bytes.
|
---|
67 | */
|
---|
68 | RTDECL(uint32_t) RTCrc32Process(uint32_t uCRC32, const void *pv, size_t cb);
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Complete a multiblock CRC32 calculation.
|
---|
72 | *
|
---|
73 | * @returns CRC32 value.
|
---|
74 | * @param uCRC32 Current CRC32 intermediate value.
|
---|
75 | */
|
---|
76 | RTDECL(uint32_t) RTCrc32Finish(uint32_t uCRC32);
|
---|
77 |
|
---|
78 |
|
---|
79 |
|
---|
80 | /** @} */
|
---|
81 |
|
---|
82 | __END_DECLS
|
---|
83 |
|
---|
84 | #endif
|
---|
85 |
|
---|