Use commited_in instead of root_commitment as salt
This commit is contained in:
parent
46625984f3
commit
f409671d3a
11
src/pcd.rs
11
src/pcd.rs
@ -94,7 +94,7 @@ impl AnkPcdHash {
|
||||
}
|
||||
|
||||
pub trait Pcd<'a>: Serialize + Deserialize<'a> {
|
||||
fn from_string(str: &str) -> Result<Value> {
|
||||
fn new_from_string(str: &str) -> Result<Value> {
|
||||
let value: Value = serde_json::from_str(str)?;
|
||||
|
||||
match value {
|
||||
@ -103,10 +103,10 @@ pub trait Pcd<'a>: Serialize + Deserialize<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn hash_fields(&self, root_commitment: OutPoint) -> Result<Map<String, Value>> {
|
||||
fn hash_all_fields(&self, commited_in: OutPoint) -> Result<Map<String, Value>> {
|
||||
let map = self.to_value_object()?;
|
||||
|
||||
let outpoint = serialize(&root_commitment);
|
||||
let outpoint = serialize(&commited_in);
|
||||
|
||||
let mut field2hash = Map::with_capacity(map.len());
|
||||
// this could be optimised since there's a midstate we're reusing
|
||||
@ -118,7 +118,7 @@ pub trait Pcd<'a>: Serialize + Deserialize<'a> {
|
||||
Ok(field2hash)
|
||||
}
|
||||
|
||||
/// We run this on the result of `hash_fields`
|
||||
/// We run this on the result of `hash_all_fields`
|
||||
fn create_merkle_tree(&self) -> Result<MerkleTree<Sha256>> {
|
||||
let map = self.to_value_object()?;
|
||||
let leaves: Result<Vec<[u8; 32]>> = map
|
||||
@ -186,8 +186,9 @@ pub trait Pcd<'a>: Serialize + Deserialize<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn decrypt_fields(
|
||||
fn decrypt_all(
|
||||
&self,
|
||||
commited_in: OutPoint,
|
||||
fields2commit: &Map<String, Value>,
|
||||
fields2keys: &Map<String, Value>,
|
||||
fields2plain: &mut Map<String, Value>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user