1 /*
2  * Checksum functions
3  *
4  * Copyright (C) 2018-2021, Joachim Metz <joachim.metz@gmail.com>
5  *
6  * Refer to AUTHORS for acknowledgements.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #if !defined( _LIBFSAPFS_CHECKSUM_H )
23 #define _LIBFSAPFS_CHECKSUM_H
24 
25 #include <common.h>
26 #include <types.h>
27 
28 #include "libfsapfs_libcerror.h"
29 #include "libfsapfs_extern.h"
30 
31 #if defined( __cplusplus )
32 extern "C" {
33 #endif
34 
35 LIBFSAPFS_EXTERN_VARIABLE \
36 uint32_t libfsapfs_checksum_crc32_table[ 256 ];
37 
38 LIBFSAPFS_EXTERN_VARIABLE \
39 int libfsapfs_checksum_crc32_table_computed;
40 
41 void libfsapfs_checksum_initialize_crc32_table(
42       uint32_t polynomial );
43 
44 int libfsapfs_checksum_calculate_weak_crc32(
45      uint32_t *checksum,
46      const uint8_t *buffer,
47      size_t size,
48      uint32_t initial_value,
49      libcerror_error_t **error );
50 
51 int libfsapfs_checksum_calculate_fletcher64(
52      uint64_t *checksum,
53      const uint8_t *buffer,
54      size_t size,
55      uint64_t initial_value,
56      libcerror_error_t **error );
57 
58 #if defined( __cplusplus )
59 }
60 #endif
61 
62 #endif /* !defined( _LIBFSAPFS_CHECKSUM_H ) */
63 
64