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
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: Copyright (C) 2023–2025 Tsukasa OI <floss_ssdeep@irq.a4lg.com>.
//! Test utilities for partial FNV hash.
use PartialFNVHash;
/// Period of this partial FNV hash when only zero bytes are processed.
///
/// After processing specified count of zero bytes from the initial state of
/// [`PartialFNVHash`], the resulting state is now back to the original one.
///
/// Note that this will not apply to full FNV-1 hash (only applies to the
/// lowest 6 bits and with a ssdeep-specific initial state).
pub const ZERO_DATA_PERIOD: u64 = 16;
/// Generate [`PartialFNVHash`] object which has the exact same state
/// as after processing specified number of zero bytes.
///
/// To simulate the condition after processing huge amount of data
/// (e.g. multiple gigabytes), the way to simulate the state is required.
/// This methods provides one of the ways to do that.
///
/// Starting from [`PartialFNVHash::FNV_HASH_INIT`], it will return to the
/// original state after processing [`ZERO_DATA_PERIOD`] zero bytes, making
/// the state only depend on the size mod [`ZERO_DATA_PERIOD`] (which is `16`).
pub