pub struct Ed25519Key { /* private fields */ }Expand description
A signing key with its public key already derived.
§Why this exists
RFC 8032 signing needs the public key: it goes into the hash that produces
k. Ed25519::sign takes only the 32-byte seed, so it has to derive the
public key on every call – a second basepoint multiplication, and with the
table in place that is most of what a signature now costs.
A key that is used more than once should derive it once. That is what a TLS
server does with a certificate key, and what dalek’s SigningKey does,
which is why comparing Ed25519::sign against it was comparing two
different amounts of work.
The trait method still exists and still takes a seed. This changes nothing for a caller signing once; it halves the cost for a caller signing twice.
Implementations§
Source§impl Ed25519Key
impl Ed25519Key
Sourcepub fn public_key(&self) -> &[u8; 32]
pub fn public_key(&self) -> &[u8; 32]
The public key, already derived.
Trait Implementations§
Source§impl Drop for Ed25519Key
impl Drop for Ed25519Key
Auto Trait Implementations§
impl Freeze for Ed25519Key
impl RefUnwindSafe for Ed25519Key
impl Send for Ed25519Key
impl Sync for Ed25519Key
impl Unpin for Ed25519Key
impl UnsafeUnpin for Ed25519Key
impl UnwindSafe for Ed25519Key
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