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
use ;
/// Converts a smaller byte array to a larger one, padding with zeros.
///
/// This function is useful for upcasting arithmetic operations. For example, when computing p^2
/// in non-modular arithmetic, having p as a U256 will cause overflow. By upcasting to U512,
/// we can perform the squaring operation without overflow.
///
/// # Type Parameters
/// * `N`: The size of the input byte array
/// * `M`: The size of the output byte array
///
/// # Arguments
/// * `smaller_bytes`: A reference to the input byte array of size `N`
///
/// # Returns
/// A new byte array of size `M` with the input bytes copied to the least significant positions
///
/// # Panics
/// If `M` is not greater than `N`
pub
/// Converts a U256 to a U512.
///
/// This function is a specific instantiation of the `to_larger_uint` function,
/// used in hashing operations where a larger uint is needed to avoid overflow.
///
/// # Arguments
/// * `u256`: A reference to the U256 value to be converted
///
/// # Returns
/// A new U512 value with the U256 value in the least significant bits
pub