From c09b8d8cd0fce0b875e68abdea2a58abaf4dc5a7 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Wed, 29 Nov 2023 10:32:20 -0500 Subject: [PATCH] feat(x/data): add simple privacy preserving merkle tree algorithm --- proto/regen/data/v1/types.proto | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/proto/regen/data/v1/types.proto b/proto/regen/data/v1/types.proto index 9287d7e69c..692d742632 100644 --- a/proto/regen/data/v1/types.proto +++ b/proto/regen/data/v1/types.proto @@ -141,6 +141,25 @@ enum GraphMerkleTree { // unspecified and valid GRAPH_MERKLE_TREE_NONE_UNSPECIFIED = 0; + + // specifies that the content hash for the graph is based on the following merkle tree algorithm: + // 1. the graph is canonicalized using the specified canonicalization algorithm + // 2. each triple in the canonicalized graph is hashed as follows: + // a. the number of triples in the graph is used as the subject and predicate salt prefix + // b. the subject is hashed using the specified digest algorithm and the salt prefix + // c. the predicate is hashed using the specified digest algorithm and the salt prefix + // d. the object is hashed using the specified digest algorithm and a salt prefix consisting of the subject hash and predicate hash + // e. the resulting hashes are concatenated + // 3. each concatenated triple hash is concatenated with the following concatenated triple hash and these + // concatenated hashes are hashed using the specified digest algorithm and inserted into an array. If + // there is an odd number of concatenated triple hashes, the last concatenated triple hash is hashed + // with itself and placed in the array. + // 4. this process is repeated on the resulting array until there is only one hash remaining which is + // the graph hash + // + // This algorithm is allows for selectively disclosing any individual triples or parts of triples in the graph + // without disclosing the entire graph. + GRAPH_MERKLE_TREE_SIMPLE_PRIVACY_PRESERVING = 1; } // ContentHashes contains list of content ContentHash.