dcrypt_algorithms/ec/p521/constants.rs
1//! Shared constants and helper functions for P-521 operations
2
3/// Size of a P-521 scalar in bytes (66 bytes)
4pub const P521_SCALAR_SIZE: usize = 66;
5
6/// Size of a P-521 field element in bytes (66 bytes)
7pub const P521_FIELD_ELEMENT_SIZE: usize = 66;
8
9/// Size of an uncompressed P-521 point in bytes: format byte (0x04) + x-coordinate + y-coordinate
10pub const P521_POINT_UNCOMPRESSED_SIZE: usize = 1 + 2 * P521_FIELD_ELEMENT_SIZE; // 1 + 132 = 133 bytes
11
12/// Size of a compressed P-521 point in bytes: format byte (0x02/0x03) + x-coordinate
13pub const P521_POINT_COMPRESSED_SIZE: usize = 1 + P521_FIELD_ELEMENT_SIZE; // 1 + 66 = 67 bytes
14
15/// Size of the KDF output for P-521 ECDH-KEM shared secret derivation (e.g., for HKDF-SHA512)
16pub const P521_KEM_SHARED_SECRET_KDF_OUTPUT_SIZE: usize = 64;
17
18/// Number of 32-bit limbs for P-521 field elements and scalars
19pub(crate) const P521_LIMBS: usize = 17;