libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
Loading...
Searching...
No Matches
spamsum.h
Go to the documentation of this file.
1/*
2 * This file is part of the Aaru Data Preservation Suite.
3 * Copyright (c) 2019-2025 Natalia Portillo.
4 *
5 * This library is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2.1 of the
8 * License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef LIBAARUFORMAT_SPAMSUM_H_
20#define LIBAARUFORMAT_SPAMSUM_H_
21
22#include <stdint.h>
23
24#define SPAMSUM_LENGTH 64
25#define NUM_BLOCKHASHES 31
26#define ROLLING_WINDOW 7
27#define HASH_INIT 0x28021967
28#define HASH_PRIME 0x01000193
29#define MIN_BLOCKSIZE 3
30#define FUZZY_MAX_RESULT ((2 * SPAMSUM_LENGTH) + 20)
31
32typedef struct
33{
34 uint32_t h;
35 uint32_t half_h;
37 uint8_t half_digest;
38 uint32_t d_len;
40
41typedef struct
42{
44 uint32_t h1;
45 uint32_t h2;
46 uint32_t h3;
47 uint32_t n;
49
50typedef struct
51{
52 uint32_t bh_start;
53 uint32_t bh_end;
55 uint64_t total_size;
58
59#endif // LIBAARUFORMAT_SPAMSUM_H_
#define SPAMSUM_LENGTH
Definition spamsum.h:24
#define ROLLING_WINDOW
Definition spamsum.h:26
#define NUM_BLOCKHASHES
Definition spamsum.h:25
uint32_t d_len
Definition spamsum.h:38
uint32_t h
Definition spamsum.h:34
uint8_t half_digest
Definition spamsum.h:37
uint8_t digest[64]
Definition spamsum.h:36
uint32_t half_h
Definition spamsum.h:35
uint32_t h2
Definition spamsum.h:45
uint32_t n
Definition spamsum.h:47
uint32_t h1
Definition spamsum.h:44
uint32_t h3
Definition spamsum.h:46
uint8_t window[7]
Definition spamsum.h:43
blockhash_ctx bh[31]
Definition spamsum.h:54
roll_state roll
Definition spamsum.h:56
uint32_t bh_end
Definition spamsum.h:53
uint64_t total_size
Definition spamsum.h:55
uint32_t bh_start
Definition spamsum.h:52