From 406747099a0391377f7cd87dedbf4cf3e0f6298b Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Fri, 14 May 2021 19:26:00 +0800 Subject: [PATCH] Test decryption using ivk and fvk --- orchard_note.py | 20 ++++- orchard_note_encryption.py | 171 ++++++++++++++++++++++++++++--------- 2 files changed, 150 insertions(+), 41 deletions(-) diff --git a/orchard_note.py b/orchard_note.py index 6a402bd..713dc42 100644 --- a/orchard_note.py +++ b/orchard_note.py @@ -1,6 +1,6 @@ import struct -from orchard_commitments import value_commit, rcv_trapdoor, note_commit +from orchard_commitments import note_commit from orchard_key_components import diversify_hash, prf_expand, derive_nullifier, FullViewingKey, SpendingKey from orchard_pallas import Point, Scalar from orchard_utils import to_base, to_scalar @@ -8,7 +8,7 @@ from orchard_utils import to_base, to_scalar from utils import leos2bsp class OrchardNote(object): - def __init__(self, d, pk_d, v, rho, rseed): + def __init__(self, d, pk_d, v: Scalar, rho, rseed): self.d = d self.pk_d = pk_d self.v = v @@ -17,19 +17,33 @@ class OrchardNote(object): self.rcm = self.rcm(rho) self.psi = self.psi(rho) + def __bytes__(self): + return ( + self.d + + bytes(self.pk_d) + + struct.pack('