Struct dusk_poseidon::cipher::PoseidonCipher
source · pub struct PoseidonCipher { /* private fields */ }
Expand description
Encapsulates an encrypted data
Implementations§
source§impl PoseidonCipher
impl PoseidonCipher
sourcepub const fn new(cipher: [BlsScalar; 3]) -> Self
pub const fn new(cipher: [BlsScalar; 3]) -> Self
PoseidonCipher
constructor
sourcepub const fn cipher_size() -> usize
pub const fn cipher_size() -> usize
Number of scalars used in a cipher
sourcepub const fn cipher_size_bytes() -> usize
pub const fn cipher_size_bytes() -> usize
Number of bytes used by from/to bytes PoseidonCipher
function
sourcepub fn initial_state(secret: &JubJubAffine, nonce: BlsScalar) -> [BlsScalar; 5]
pub fn initial_state(secret: &JubJubAffine, nonce: BlsScalar) -> [BlsScalar; 5]
Returns the initial state of the encryption
sourcepub fn encrypt(
message: &[BlsScalar],
secret: &JubJubAffine,
nonce: &BlsScalar
) -> Self
pub fn encrypt( message: &[BlsScalar], secret: &JubJubAffine, nonce: &BlsScalar ) -> Self
Encrypt a slice of scalars into an internal cipher representation
The message size will be truncated to PoseidonCipher::capacity()
bits
Trait Implementations§
source§impl Clone for PoseidonCipher
impl Clone for PoseidonCipher
source§fn clone(&self) -> PoseidonCipher
fn clone(&self) -> PoseidonCipher
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PoseidonCipher
impl Debug for PoseidonCipher
source§impl Default for PoseidonCipher
impl Default for PoseidonCipher
source§fn default() -> PoseidonCipher
fn default() -> PoseidonCipher
Returns the “default value” for a type. Read more
source§impl Ord for PoseidonCipher
impl Ord for PoseidonCipher
source§fn cmp(&self, other: &PoseidonCipher) -> Ordering
fn cmp(&self, other: &PoseidonCipher) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<PoseidonCipher> for PoseidonCipher
impl PartialEq<PoseidonCipher> for PoseidonCipher
source§fn eq(&self, other: &PoseidonCipher) -> bool
fn eq(&self, other: &PoseidonCipher) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<PoseidonCipher> for PoseidonCipher
impl PartialOrd<PoseidonCipher> for PoseidonCipher
source§fn partial_cmp(&self, other: &PoseidonCipher) -> Option<Ordering>
fn partial_cmp(&self, other: &PoseidonCipher) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serializable<CIPHER_BYTES_SIZE> for PoseidonCipher
impl Serializable<CIPHER_BYTES_SIZE> for PoseidonCipher
impl Copy for PoseidonCipher
impl Eq for PoseidonCipher
impl StructuralEq for PoseidonCipher
impl StructuralPartialEq for PoseidonCipher
Auto Trait Implementations§
impl RefUnwindSafe for PoseidonCipher
impl Send for PoseidonCipher
impl Sync for PoseidonCipher
impl Unpin for PoseidonCipher
impl UnwindSafe for PoseidonCipher
Blanket Implementations§
source§impl<'a, C, A> Annotation<&'a C> for Awhere
A: Annotation<C>,
impl<'a, C, A> Annotation<&'a C> for Awhere A: Annotation<C>,
source§fn from_child(t: &&'a C) -> A
fn from_child(t: &&'a C) -> A
Compute the annotation from the child.
source§impl<'a, C, A> Annotation<&'a mut C> for Awhere
A: Annotation<C>,
impl<'a, C, A> Annotation<&'a mut C> for Awhere A: Annotation<C>,
source§fn from_child(t: &&'a mut C) -> A
fn from_child(t: &&'a mut C) -> A
Compute the annotation from the child.
source§impl<C, A> Annotation<Arc<C>> for Awhere
A: Annotation<C>,
impl<C, A> Annotation<Arc<C>> for Awhere A: Annotation<C>,
source§fn from_child(t: &Arc<C>) -> A
fn from_child(t: &Arc<C>) -> A
Compute the annotation from the child.
source§impl<C, A> Annotation<Box<C, Global>> for Awhere
A: Annotation<C>,
impl<C, A> Annotation<Box<C, Global>> for Awhere A: Annotation<C>,
source§fn from_child(t: &Box<C, Global>) -> A
fn from_child(t: &Box<C, Global>) -> A
Compute the annotation from the child.
source§impl<C, A> Annotation<Rc<C>> for Awhere
A: Annotation<C>,
impl<C, A> Annotation<Rc<C>> for Awhere A: Annotation<C>,
source§fn from_child(t: &Rc<C>) -> A
fn from_child(t: &Rc<C>) -> A
Compute the annotation from the child.
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 `