pub enum ChecksumValue {
None,
Crc32c(u32),
Crc64(u64),
Md5([u8; 16]),
}Expand description
Content of the messageChecksum (variable per ChecksumKind).
Variants§
None
No checksum field written.
Crc32c(u32)
CRC-32C u32.
Crc64(u64)
CRC-64-XZ u64.
Md5([u8; 16])
MD5-128 16-byte hash.
Implementations§
Source§impl ChecksumValue
impl ChecksumValue
Sourcepub fn kind(&self) -> ChecksumKind
pub fn kind(&self) -> ChecksumKind
Associated ChecksumKind.
Sourcepub fn compute(kind: ChecksumKind, payload: &[u8]) -> Self
pub fn compute(kind: ChecksumKind, payload: &[u8]) -> Self
Computes the messageChecksum over payload with the
desired algorithm (DDSI-RTPS 2.5 §9.4.2.15.2).
payload is the range over which the checksum is computed.
Per spec these are the submessages after the
HeaderExtension submessage; the caller ensures this via
an appropriate slice cut.
Implemented via zerodds_foundation::crc32c,
zerodds_foundation::crc64_xz and zerodds_foundation::md5 —
pure-Rust no_std hashes without an external crypto-crate
dependency (Pillar 9 zero-dependency).
Sourcepub fn verify(&self, payload: &[u8]) -> bool
pub fn verify(&self, payload: &[u8]) -> bool
Verifies that the checksum held in this value matches the one
computed over payload.
Returns true if the algorithm is active AND the value
matches; true also if kind() == None (no checksum
declared, nothing to verify); false on mismatch.
Spec §9.4.2.15.2: the receiver discards the message on mismatch.
Trait Implementations§
Source§impl Clone for ChecksumValue
impl Clone for ChecksumValue
Source§fn clone(&self) -> ChecksumValue
fn clone(&self) -> ChecksumValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more