mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-07-30 20:11:23 +00:00
Trial Sapling note decryption
This commit is contained in:
@@ -47,6 +47,7 @@ pub mod tests;
|
||||
pub enum Unknown { }
|
||||
|
||||
/// Point of prime order.
|
||||
#[derive(Debug)]
|
||||
pub enum PrimeOrder { }
|
||||
|
||||
/// Fixed generators of the Jubjub curve of unknown
|
||||
|
@@ -116,7 +116,7 @@ impl<E: JubjubEngine> ViewingKey<E> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub struct Diversifier(pub [u8; 11]);
|
||||
|
||||
impl Diversifier {
|
||||
@@ -129,12 +129,18 @@ impl Diversifier {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PaymentAddress<E: JubjubEngine> {
|
||||
pub pk_d: edwards::Point<E, PrimeOrder>,
|
||||
pub diversifier: Diversifier
|
||||
}
|
||||
|
||||
impl<E: JubjubEngine> PartialEq for PaymentAddress<E> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.pk_d == other.pk_d && self.diversifier == other.diversifier
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: JubjubEngine> PaymentAddress<E> {
|
||||
pub fn g_d(
|
||||
&self,
|
||||
@@ -162,7 +168,7 @@ impl<E: JubjubEngine> PaymentAddress<E> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Note<E: JubjubEngine> {
|
||||
/// The value of the note
|
||||
pub value: u64,
|
||||
@@ -174,6 +180,15 @@ pub struct Note<E: JubjubEngine> {
|
||||
pub r: E::Fs
|
||||
}
|
||||
|
||||
impl<E: JubjubEngine> PartialEq for Note<E> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.value == other.value
|
||||
&& self.g_d == other.g_d
|
||||
&& self.pk_d == other.pk_d
|
||||
&& self.r == other.r
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: JubjubEngine> Note<E> {
|
||||
pub fn uncommitted() -> E::Fr {
|
||||
// The smallest u-coordinate that is not on the curve
|
||||
|
Reference in New Issue
Block a user