pub struct KGenerator<'a, D: OutputSizeUser, U> { /* private fields */ }Expand description
Deterministic generator for the ephemeral scalar k as used by (EC)DSA.
Implementations§
Source§impl<'a, D, U> KGenerator<'a, D, U>
impl<'a, D, U> KGenerator<'a, D, U>
Sourcepub fn new(x: &[u8], h: &[u8], data: &[u8], q: &'a U) -> Self
pub fn new(x: &[u8], h: &[u8], data: &[u8], q: &'a U) -> Self
Initialize k generator.
Accepts the following parameters and inputs:
x: secret keyh: raw hash/digest of input messagedata: additional associated data, e.g. CSRNG output used as added entropyq: field modulus
Sourcepub fn fill_next_k(&mut self, k: &mut [u8])
pub fn fill_next_k(&mut self, k: &mut [u8])
Generate a candidate k value.
This may be called repeatedly in the event a particular k is unsuitable, e.g. the
resulting r value is zero.
Trait Implementations§
Auto Trait Implementations§
impl<'a, D, U> Freeze for KGenerator<'a, D, U>
impl<'a, D, U> RefUnwindSafe for KGenerator<'a, D, U>where
U: RefUnwindSafe,
<<D as OutputSizeUser>::OutputSize as ArraySize>::ArrayType<u8>: RefUnwindSafe,
impl<'a, D, U> Send for KGenerator<'a, D, U>where
U: Sync,
impl<'a, D, U> Sync for KGenerator<'a, D, U>where
U: Sync,
impl<'a, D, U> Unpin for KGenerator<'a, D, U>
impl<'a, D, U> UnsafeUnpin for KGenerator<'a, D, U>where
<<D as OutputSizeUser>::OutputSize as ArraySize>::ArrayType<u8>: UnsafeUnpin,
impl<'a, D, U> UnwindSafe for KGenerator<'a, D, U>where
U: RefUnwindSafe,
<<D as OutputSizeUser>::OutputSize as ArraySize>::ArrayType<u8>: UnwindSafe,
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