Struct solana_zk_token_sdk::encryption::elgamal::ElGamalCiphertext
source · [−]pub struct ElGamalCiphertext {
pub commitment: PedersenCommitment,
pub handle: DecryptHandle,
}
Expand description
Ciphertext for the ElGamal encryption scheme.
Fields
commitment: PedersenCommitment
handle: DecryptHandle
Implementations
sourceimpl ElGamalCiphertext
impl ElGamalCiphertext
pub fn add_amount<T: Into<Scalar>>(&self, amount: T) -> Self
pub fn subtract_amount<T: Into<Scalar>>(&self, amount: T) -> Self
pub fn to_bytes(&self) -> [u8; 64]
pub fn from_bytes(bytes: &[u8]) -> Option<ElGamalCiphertext>
sourcepub fn decrypt(&self, secret: &ElGamalSecretKey) -> DiscreteLog
pub fn decrypt(&self, secret: &ElGamalSecretKey) -> DiscreteLog
Decrypts the ciphertext using an ElGamal secret key.
The output of this function is of type DiscreteLog
. To recover, the originally encrypted
message, use DiscreteLog::decode
.
sourcepub fn decrypt_u32(&self, secret: &ElGamalSecretKey) -> Option<u64>
pub fn decrypt_u32(&self, secret: &ElGamalSecretKey) -> Option<u64>
Decrypts the ciphertext using an ElGamal secret key interpretting the message as type u32
.
Trait Implementations
sourceimpl<'a, 'b> Add<&'b ElGamalCiphertext> for &'a ElGamalCiphertext
impl<'a, 'b> Add<&'b ElGamalCiphertext> for &'a ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the +
operator.
sourcefn add(self, other: &'b ElGamalCiphertext) -> ElGamalCiphertext
fn add(self, other: &'b ElGamalCiphertext) -> ElGamalCiphertext
Performs the +
operation. Read more
sourceimpl<'b> Add<&'b ElGamalCiphertext> for ElGamalCiphertext
impl<'b> Add<&'b ElGamalCiphertext> for ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the +
operator.
sourcefn add(self, rhs: &'b ElGamalCiphertext) -> ElGamalCiphertext
fn add(self, rhs: &'b ElGamalCiphertext) -> ElGamalCiphertext
Performs the +
operation. Read more
sourceimpl<'a> Add<ElGamalCiphertext> for &'a ElGamalCiphertext
impl<'a> Add<ElGamalCiphertext> for &'a ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the +
operator.
sourcefn add(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
fn add(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
Performs the +
operation. Read more
sourceimpl Add<ElGamalCiphertext> for ElGamalCiphertext
impl Add<ElGamalCiphertext> for ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the +
operator.
sourcefn add(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
fn add(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
Performs the +
operation. Read more
sourceimpl Clone for ElGamalCiphertext
impl Clone for ElGamalCiphertext
sourcefn clone(&self) -> ElGamalCiphertext
fn clone(&self) -> ElGamalCiphertext
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ElGamalCiphertext
impl Debug for ElGamalCiphertext
sourceimpl Default for ElGamalCiphertext
impl Default for ElGamalCiphertext
sourcefn default() -> ElGamalCiphertext
fn default() -> ElGamalCiphertext
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for ElGamalCiphertext
impl<'de> Deserialize<'de> for ElGamalCiphertext
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<ElGamalCiphertext> for ElGamalCiphertext
impl From<ElGamalCiphertext> for ElGamalCiphertext
sourcefn from(ct: ElGamalCiphertext) -> Self
fn from(ct: ElGamalCiphertext) -> Self
Converts to this type from the input type.
sourceimpl<'a, 'b> Mul<&'b Scalar> for &'a ElGamalCiphertext
impl<'a, 'b> Mul<&'b Scalar> for &'a ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the *
operator.
sourcefn mul(self, other: &'b Scalar) -> ElGamalCiphertext
fn mul(self, other: &'b Scalar) -> ElGamalCiphertext
Performs the *
operation. Read more
sourceimpl<'b> Mul<&'b Scalar> for ElGamalCiphertext
impl<'b> Mul<&'b Scalar> for ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: &'b Scalar) -> ElGamalCiphertext
fn mul(self, rhs: &'b Scalar) -> ElGamalCiphertext
Performs the *
operation. Read more
sourceimpl<'a> Mul<Scalar> for &'a ElGamalCiphertext
impl<'a> Mul<Scalar> for &'a ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: Scalar) -> ElGamalCiphertext
fn mul(self, rhs: Scalar) -> ElGamalCiphertext
Performs the *
operation. Read more
sourceimpl Mul<Scalar> for ElGamalCiphertext
impl Mul<Scalar> for ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: Scalar) -> ElGamalCiphertext
fn mul(self, rhs: Scalar) -> ElGamalCiphertext
Performs the *
operation. Read more
sourceimpl PartialEq<ElGamalCiphertext> for ElGamalCiphertext
impl PartialEq<ElGamalCiphertext> for ElGamalCiphertext
sourcefn eq(&self, other: &ElGamalCiphertext) -> bool
fn eq(&self, other: &ElGamalCiphertext) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ElGamalCiphertext) -> bool
fn ne(&self, other: &ElGamalCiphertext) -> bool
This method tests for !=
.
sourceimpl Serialize for ElGamalCiphertext
impl Serialize for ElGamalCiphertext
sourceimpl<'a, 'b> Sub<&'b ElGamalCiphertext> for &'a ElGamalCiphertext
impl<'a, 'b> Sub<&'b ElGamalCiphertext> for &'a ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the -
operator.
sourcefn sub(self, other: &'b ElGamalCiphertext) -> ElGamalCiphertext
fn sub(self, other: &'b ElGamalCiphertext) -> ElGamalCiphertext
Performs the -
operation. Read more
sourceimpl<'b> Sub<&'b ElGamalCiphertext> for ElGamalCiphertext
impl<'b> Sub<&'b ElGamalCiphertext> for ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the -
operator.
sourcefn sub(self, rhs: &'b ElGamalCiphertext) -> ElGamalCiphertext
fn sub(self, rhs: &'b ElGamalCiphertext) -> ElGamalCiphertext
Performs the -
operation. Read more
sourceimpl<'a> Sub<ElGamalCiphertext> for &'a ElGamalCiphertext
impl<'a> Sub<ElGamalCiphertext> for &'a ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the -
operator.
sourcefn sub(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
fn sub(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
Performs the -
operation. Read more
sourceimpl Sub<ElGamalCiphertext> for ElGamalCiphertext
impl Sub<ElGamalCiphertext> for ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the -
operator.
sourcefn sub(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
fn sub(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
Performs the -
operation. Read more
sourceimpl TryFrom<ElGamalCiphertext> for ElGamalCiphertext
impl TryFrom<ElGamalCiphertext> for ElGamalCiphertext
type Error = ProofError
type Error = ProofError
The type returned in the event of a conversion error.
sourcefn try_from(ct: ElGamalCiphertext) -> Result<Self, Self::Error>
fn try_from(ct: ElGamalCiphertext) -> Result<Self, Self::Error>
Performs the conversion.
impl Copy for ElGamalCiphertext
impl Eq for ElGamalCiphertext
impl StructuralEq for ElGamalCiphertext
impl StructuralPartialEq for ElGamalCiphertext
Auto Trait Implementations
impl RefUnwindSafe for ElGamalCiphertext
impl Send for ElGamalCiphertext
impl Sync for ElGamalCiphertext
impl Unpin for ElGamalCiphertext
impl UnwindSafe for ElGamalCiphertext
Blanket Implementations
impl<T> AbiEnumVisitor for T where
T: Serialize + ?Sized,
impl<T> AbiEnumVisitor for T where
T: Serialize + ?Sized,
default fn visit_for_abi(
&self,
_digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
impl<T> AbiEnumVisitor for T where
T: Serialize + AbiExample + ?Sized,
impl<T> AbiEnumVisitor for T where
T: Serialize + AbiExample + ?Sized,
default fn visit_for_abi(
&self,
digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more