diff --git a/README.md b/README.md index addf66b..ebcaf0c 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Add *merkle-tree* as a dependency to your project. * Gradle ``` - implementation 'ascelion.public:merkle-tree:1.0.0' + implementation 'ascelion.public:merkle-tree:1.0.1' ``` * Maven @@ -17,7 +17,7 @@ Add *merkle-tree* as a dependency to your project. ascelion.public merkle-tree - 1.0.0 + 1.0.1 ```` @@ -49,3 +49,6 @@ Use the TreeBuilder to create a Merkle tree You may also want to check the demo project for a real example. +Also [see the javadoc](https://ascelion.github.io/merkle-tree/index.html). + + diff --git a/impl/src/main/java/overview.html b/impl/src/main/java/overview.html new file mode 100644 index 0000000..dc74451 --- /dev/null +++ b/impl/src/main/java/overview.html @@ -0,0 +1,58 @@ + + +

Merkle Tree

+ +

A generic implementation of Merkle trees

+ +

Usage

+ +

Add merkle-tree as a dependency to your project.

+ + + +
  implementation 'ascelion.public:merkle-tree:1.0.0'
+
+ + + +
  <dependency>
+    <groupId>ascelion.public</groupId>
+    <artifactId>merkle-tree</artifactId>
+    <version>1.0.0</version>
+  </dependency>
+
+ +

`

+ +

Use the TreeBuilder to create a Merkle tree

+ +
  // create a hash function
+  UnaryOperator<String> hashFn = ...
+
+  // create a concatenation function
+  BinaryOperator<String, String> concatFn = (s1, s2) -> s1 + s2;
+
+  // create a tree builder
+  TreeBuilder<String> tbd = new TreeBuilder<>(hashFn, concatFn, "");
+
+  // add some nodes and build the tree
+  TreeRoot<String> root = tbd
+                .collect( new TreeLeaf<>(hashFn, "s1" )
+                // ....
+                .collect( new TreeLeaf<>(hashFn, "s2") )
+                .build();
+
+  // get a leaf
+  TreeLeaf<String> leaf1 = root.getLeaf( 0 );
+
+  // validate the hash chain
+  assertTrue( tbd.validate( leaf1.getChain() ) );
+
+ +

You may also want to check the demo project for a real example.

+ + diff --git a/publish.gradle b/publish.gradle index 696b38e..c8abad3 100644 --- a/publish.gradle +++ b/publish.gradle @@ -27,6 +27,8 @@ javadoc { options { memberLevel = 'PROTECTED' + overview = file( 'src/main/java/overview.html' ) + links += [ 'https://docs.oracle.com/javase/8/docs/api' ] } }