pub struct MlsKeyIdLayout { /* private fields */ }Expand description
The KID layout of an MLS-keyed session (RFC 9605 section 5.2, Figure 8).
64-S-E bits S bits E bits
<-----------> <------> <------>
+-------------+--------+-------+
| Context ID | Index | Epoch |
+-------------+--------+-------+KID = (context << (S + E)) + (sender_index << E) + (epoch % (1 << E)). E is set by the
application and bounds how many epochs can be active at once; S is the number of bits a
member index of the group needs.
Implementations§
Source§impl MlsKeyIdLayout
impl MlsKeyIdLayout
Sourcepub fn new(epoch_bits: u32, sender_bits: u32) -> Result<Self>
pub fn new(epoch_bits: u32, sender_bits: u32) -> Result<Self>
A layout with epoch_bits (E) and sender_bits (S); together at most 64.
Sourcepub fn for_group_size(epoch_bits: u32, group_size: u64) -> Result<Self>
pub fn for_group_size(epoch_bits: u32, group_size: u64) -> Result<Self>
A layout for a group of group_size members: S is the smallest value such that
group_size <= (1 << S).
Sourcepub const fn epoch_bits(&self) -> u32
pub const fn epoch_bits(&self) -> u32
E: the number of low-order bits that carry the epoch.
Sourcepub const fn sender_bits(&self) -> u32
pub const fn sender_bits(&self) -> u32
S: the number of bits that carry the sender’s member index.
Sourcepub const fn context_bits(&self) -> u32
pub const fn context_bits(&self) -> u32
The number of bits left for the sender’s context value: 64 - S - E.
Sourcepub const fn epoch_slot(&self, epoch: u64) -> u64
pub const fn epoch_slot(&self, epoch: u64) -> u64
The low E bits of epoch: what a KID carries of it, and what two epochs must differ
in to be active together.
Trait Implementations§
Source§impl Clone for MlsKeyIdLayout
impl Clone for MlsKeyIdLayout
impl Copy for MlsKeyIdLayout
Source§impl Debug for MlsKeyIdLayout
impl Debug for MlsKeyIdLayout
impl Eq for MlsKeyIdLayout
Source§impl Hash for MlsKeyIdLayout
impl Hash for MlsKeyIdLayout
Source§impl PartialEq for MlsKeyIdLayout
impl PartialEq for MlsKeyIdLayout
impl StructuralPartialEq for MlsKeyIdLayout
Auto Trait Implementations§
impl Forget for MlsKeyIdLayout
impl Freeze for MlsKeyIdLayout
impl Move for MlsKeyIdLayout
impl RefUnwindSafe for MlsKeyIdLayout
impl Send for MlsKeyIdLayout
impl Sync for MlsKeyIdLayout
impl Unpin for MlsKeyIdLayout
impl UnsafeUnpin for MlsKeyIdLayout
impl UnwindSafe for MlsKeyIdLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more