Struct phoenix_core::message::Message
source · pub struct Message { /* private fields */ }
Expand description
Message structure with value commitment
Implementations§
source§impl Message
impl Message
sourcepub fn new<R: RngCore + CryptoRng>(
rng: &mut R,
r: &JubJubScalar,
psk: &PublicSpendKey,
value: u64
) -> Self
pub fn new<R: RngCore + CryptoRng>( rng: &mut R, r: &JubJubScalar, psk: &PublicSpendKey, value: u64 ) -> Self
Create a new message
r
will be later used to decrypt the value and blinding factor
sourcepub fn to_hash_inputs(&self) -> [BlsScalar; 6]
pub fn to_hash_inputs(&self) -> [BlsScalar; 6]
Represent the message as a sequence of scalars to be used as input for sponge hash functions
It is composed by 3 scalars, in order:
- Value commitment X
- Value commitment Y
- Nonce
And also appends the scalars that composes the PoseidonCipher
sourcepub const fn value_commitment(&self) -> &JubJubExtended
pub const fn value_commitment(&self) -> &JubJubExtended
Value commitment representation of the message
sourcepub const fn nonce(&self) -> &BlsScalar
pub const fn nonce(&self) -> &BlsScalar
Nonce used for the encryption of the value and blinding factor
sourcepub fn decrypt(
&self,
r: &JubJubScalar,
psk: &PublicSpendKey
) -> Result<(u64, JubJubScalar), Error>
pub fn decrypt( &self, r: &JubJubScalar, psk: &PublicSpendKey ) -> Result<(u64, JubJubScalar), Error>
Decrypt the value and blinding factor provided the r
used in the
creation of the message
Trait Implementations§
source§impl PartialEq<Message> for Message
impl PartialEq<Message> for Message
source§impl Serializable<{ JubJubAffine::SIZE + JubJubScalar::SIZE + PoseidonCipher::SIZE }> for Message
impl Serializable<{ JubJubAffine::SIZE + JubJubScalar::SIZE + PoseidonCipher::SIZE }> for Message
impl Copy for Message
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
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
source§impl<T, const N: usize> DeserializableSlice<N> for Twhere
T: Serializable<N>,
impl<T, const N: usize> DeserializableSlice<N> for Twhere T: Serializable<N>,
source§impl<T, const N: usize> ParseHexStr<N> for Twhere
T: Serializable<N>,
impl<T, const N: usize> ParseHexStr<N> for Twhere T: Serializable<N>,
source§fn from_hex_str(s: &str) -> Result<Self, Self::Error>where
Self: Sized,
Self::Error: BadLength + InvalidChar,
fn from_hex_str(s: &str) -> Result<Self, Self::Error>where Self: Sized, Self::Error: BadLength + InvalidChar,
Parse a string slice as bytes hex representation and returns `