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
//! Byte serialization for field elements.
//!
//! [`FieldBytes`] extends [`Field`] with byte-level
//! serialization, enabling field elements to be absorbed into and
//! squeezed from a Fiat-Shamir transcript.
use crateError;
use crateField;
/// Byte serialization for field elements.
///
/// Required by proof-system transcripts to absorb and squeeze
/// field elements deterministically.
///
/// # Examples
///
/// ```
/// use field_cat::{BabyBear, FieldBytes};
///
/// let a = BabyBear::new(123_456);
/// let bytes = a.to_le_bytes();
/// let b = BabyBear::from_le_bytes(&bytes)?;
/// assert_eq!(a, b);
/// # Ok::<(), field_cat::Error>(())
/// ```