pub(crate) struct RCompute<CtxDigest> {
key: VerifyingKey,
signature: InternalSignature,
h: CtxDigest,
}Expand description
Helper for verification. Computes the expected R component of the signature. The
caller compares this to the real R component.
This computes H(R || A || M) where H is the 512-bit hash function
given by CtxDigest (this is SHA-512 in spec-compliant Ed25519).
For pre-hashed variants a h with the context already included can be provided.
Note that this returns the compressed form of R and the caller does a byte comparison. This
means that all our verification functions do not accept non-canonically encoded R values.
See the validation criteria blog post for more details:
https://hdevalence.ca/blog/2020-10-04-its-25519am
Fields§
§key: VerifyingKey§signature: InternalSignature§h: CtxDigestImplementations§
Source§impl<CtxDigest> RCompute<CtxDigest>
impl<CtxDigest> RCompute<CtxDigest>
Sourcepub(crate) fn compute(
key: &VerifyingKey,
signature: InternalSignature,
prehash_ctx: Option<&[u8]>,
message: &[&[u8]],
) -> CompressedEdwardsY
pub(crate) fn compute( key: &VerifyingKey, signature: InternalSignature, prehash_ctx: Option<&[u8]>, message: &[&[u8]], ) -> CompressedEdwardsY
If prehash_ctx.is_some(), this does the prehashed variant of the computation using its
contents.
pub(crate) fn new( key: &VerifyingKey, signature: InternalSignature, prehash_ctx: Option<&[u8]>, ) -> Self
pub(crate) fn update(&mut self, m: &[u8])
pub(crate) fn finish(self) -> CompressedEdwardsY
Auto Trait Implementations§
impl<CtxDigest> Freeze for RCompute<CtxDigest>where
CtxDigest: Freeze,
impl<CtxDigest> RefUnwindSafe for RCompute<CtxDigest>where
CtxDigest: RefUnwindSafe,
impl<CtxDigest> Send for RCompute<CtxDigest>where
CtxDigest: Send,
impl<CtxDigest> Sync for RCompute<CtxDigest>where
CtxDigest: Sync,
impl<CtxDigest> Unpin for RCompute<CtxDigest>where
CtxDigest: Unpin,
impl<CtxDigest> UnsafeUnpin for RCompute<CtxDigest>where
CtxDigest: UnsafeUnpin,
impl<CtxDigest> UnwindSafe for RCompute<CtxDigest>where
CtxDigest: 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