pub fn create_origin_mac_challenge_parts(
    protocol_version: DhtProtocolVersion,
    destination: &NodeDestination,
    message_type: DhtMessageType,
    flags: DhtMessageFlags,
    expires: Option<EpochTime>,
    ephemeral_public_key: Option<&CommsPublicKey>,
    body: &[u8],
) -> Challenge {
    let mut mac_challenge = Challenge::new();
    mac_challenge.update(&protocol_version.to_bytes());
    mac_challenge.update(destination.as_inner_bytes());
    mac_challenge.update(&(message_type as i32).to_le_bytes());
    mac_challenge.update(&flags.bits().to_le_bytes());
    if let Some(t) = expires {
        mac_challenge.update(&t.as_u64().to_le_bytes());
    }
    if let Some(e_pk) = ephemeral_public_key.as_ref() {
        mac_challenge.update(e_pk.as_bytes());
    }
    mac_challenge.update(&body);
    mac_challenge
}
/// Generates a challenge for the origin MAC.
Generates a challenge for the origin MAC.
Generates a challenge for the origin MAC .
pub fn create_origin_mac_challenge_parts(
    protocol_version: DhtProtocolVersion,
    destination: &NodeDestination,
    message_type: DhtMessageType,
    flags: DhtMessageFlags,
    expires: Option<EpochTime>,
    ephemeral_public_key: Option<&CommsPublicKey>,
    body: &[u8],
) -> Challenge {
    let mut mac_challenge = Challenge::new();
    mac_challenge.update(&protocol_version.to_bytes());
    mac_challenge.update(destination.as_inner_bytes());
    mac_challenge.update(&(message_type as i32).to_le_bytes());
    mac_challenge.update(&flags.bits().to_le_bytes());
    if let Some(t) = expires {
        mac_challenge.update(&t.as_u64().to_le_bytes());
    }
    if let Some(e_pk) = ephemeral_public_key.as_ref() {
        mac_challenge.update(e_pk.as_bytes());
    }
    mac_challenge.update(&body);
    mac_challenge
}
pub fn create_origin_mac_challenge_parts ( protocol_version : DhtProtocolVersion , destination : & NodeDestination , message_type : DhtMessageType , flags : DhtMessageFlags , expires : Option < EpochTime > , ephemeral_public_key : Option < & CommsPublicKey > , body : & [ u8 ] , ) -> Challenge { let mut mac_challenge = Challenge :: new ( ) ; mac_challenge . update ( & protocol_version . to_bytes ( ) ) ; mac_challenge . update ( destination . as_inner_bytes ( ) ) ; mac_challenge . update ( & ( message_type as i32 ) . to_le_bytes ( ) ) ; mac_challenge . update ( & flags . bits ( ) . to_le_bytes ( ) ) ; if let Some ( t ) = expires { mac_challenge . update ( & t . as_u64 ( ) . to_le_bytes ( ) ) ; } if let Some ( e_pk ) = ephemeral_public_key . as_ref ( ) { mac_challenge . update ( e_pk . as_bytes ( ) ) ; } mac_challenge . update ( & body ) ; mac_challenge }
Generates a challenge for the origin MAC.
Generates a challenge for the origin MAC .
protocol_version
DhtProtocolVersion
destination
&NodeDestination
message_type
DhtMessageType
flags
DhtMessageFlags
expires
Option<EpochTime>
ephemeral_public_key
Option<&CommsPublicKey>
body
&[u8]
protocol_version
DhtProtocolVersion
destination
&NodeDestination
message_type
DhtMessageType
flags
DhtMessageFlags
expires
Option<EpochTime>
ephemeral_public_key
Option<&CommsPublicKey>
body
&[u8]