pub trait Sign {
// Required methods
fn reset(&mut self);
fn digest(&mut self, bytes: &[u8]);
fn produce(&self) -> SignatureValue;
}
Expand description
Interface for MAVLink 2
frames signing algorithm.
An implementor of Sign
should be capable to calculate sha256_48
, a MAVLink 2
specific
hashing algorithm similar to regular sha256
except that only first 48 bits are considered.
§Links
Signer
wraps and implementor ofSign
and capable of signing and validating frames.- Values calculated by implementors of
Sign
are stored inSignature
struct asvalue
. - Signature specification format in MAVLink docs.
Required Methods§
sourcefn reset(&mut self)
fn reset(&mut self)
Reset inner state of a signer.
Used by caller to ensure that signer’s inner state does not have any digested data.
sourcefn digest(&mut self, bytes: &[u8])
fn digest(&mut self, bytes: &[u8])
Adds value to digest.
Caller can invoke Sign::digest
multiple times. Passing data as several sequential chunks
is the same as calling digest
with the whole data at once.
sourcefn produce(&self) -> SignatureValue
fn produce(&self) -> SignatureValue
Produces MAVLink 2
signature from the internal state.