Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: extensions/browser/content_hash_tree.h

Issue 274243004: Add code to compute the root hash for a hash tree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed bugs and added tests Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/content_hash_tree.h
diff --git a/extensions/browser/content_hash_tree.h b/extensions/browser/content_hash_tree.h
new file mode 100644
index 0000000000000000000000000000000000000000..d131b418fcbcbff630574ce91eb621ff57d2cef9
--- /dev/null
+++ b/extensions/browser/content_hash_tree.h
@@ -0,0 +1,22 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_CONTENT_HASH_TREE_H_
+#define EXTENSIONS_BROWSER_CONTENT_HASH_TREE_H_
+
+#include <string>
+#include <vector>
+
+namespace extensions {
+
+// This takes a list of sha256 hashes, considers them to be leaf nodes of a
+// hash tree (aka Merkle tree), and computes the hash of the root node of the
+// tree using a branching factor of |block_size| / sizeof(sha256hash). The
+// block size should be a multiple of sizeof(sha256hash).
Marijn Kruisselbrink 2014/05/12 17:53:45 From the code here it isn't entirely clear why you
Marijn Kruisselbrink 2014/05/12 17:53:45 You should probably explicitly document how this m
asargent_no_longer_on_chrome 2014/05/12 21:58:58 Added documentation about numbers of nodes that ar
asargent_no_longer_on_chrome 2014/05/12 21:58:58 I refactored this code out from being inline in an
+std::string ComputeTreeHashRoot(const std::vector<std::string>& leaf_hashes,
+ int block_size);
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_CONTENT_HASH_TREE_H_

Powered by Google App Engine
This is Rietveld 408576698