Skip to main content

RCompute

Struct RCompute 

Source
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: CtxDigest

Implementations§

Source§

impl<CtxDigest> RCompute<CtxDigest>
where CtxDigest: Digest<OutputSize = U64>,

Source

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.

Source

pub(crate) fn new( key: &VerifyingKey, signature: InternalSignature, prehash_ctx: Option<&[u8]>, ) -> Self

Source

pub(crate) fn update(&mut self, m: &[u8])

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.