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
//! Implementation of a lightweight, stateful FIX checksum (Digest) calculator.
/// The [`Digest`] maintains a running checksum by performing modulo-256 addition over all
/// processed bytes, exactly as defined by the FIX checksum algorithm. This is typically used while
/// encoding and decoding FIX messages.
///
/// # Example
///
/// ```ignore
/// let mut digest = Digest::default();
/// digest.push(&[1, 2, 3]);
/// let checksum = digest.checksum();
///
/// // (1 + 2 + 3) % 256 = 6
/// assert_eq!(checksum, 6);
///
/// // (1 + 2 + 3 + 251) % 256 = 257 % 256 = 1
/// digest.push(251);
/// assert_eq!(checksum, 1);
/// ```
pub