166 Commits

Author SHA1 Message Date
7a5e9a92cb Bump ring to ^0.6.0 and protobuf to ^1.2.0. 2017-02-15 23:11:00 +01:00
d45356c9ed Re-generate documentation. 2017-02-15 23:08:16 +01:00
249234caca Adopting Hashable trait.
* Remove useless T: AsRef<[u8]> constraint in Lemma.

* Introduce a custom `Hashable` trait instead of requiring `AsRef<[u8]>`.

Since not every type can implement `AsRef<[u8]>`,
this commit removes that constraint, and requires instead
that values implement the `Hashable` trait.

A default instance is provided for types that already implements `AsRef<[u8]>`.

* Update documentation.

* Add a Protobuf test with custom struct and Hashable impl.
2016-12-20 10:23:07 +01:00
bce59c9f39 Separate the leafs hash domain from the internal nodes' one (#22)
* Separate the leafs hash domain from the internal nodes' one.

This change prevents an internal node from having the same hash as a leaf,
and thus from potentially ending up with two different trees with the same root hash.

Close #20

* Align with the CT spec, and allows building a tree from an empty dataset.

Fixes #20. Prepares #24.
2016-12-19 16:14:41 +01:00
bebbcde461 Fix nightly build. (#23)
Discarding unused qualifications lint in protobuf module.
2016-12-13 20:57:07 +01:00
46ee60a748 Use AsRef everywhere instead of Into + remove unneeded Clone bounds on T (#21)
* Replace Into<Vec<u8>> bound on T with AsRef<[u8]>.

* Remove unneeded Clone bounds on T.
2016-12-12 18:29:54 +01:00
90d804e3ce Update documentation. 2016-12-07 22:49:05 +01:00
fc21e66792 Add a changelog. 2016-12-07 22:32:24 +01:00
5327ea2af2 Merge pull request #17 from briansmith/more_efficient
Reduce heap usage by returning digests by value
2016-12-02 20:59:28 +01:00
af7e294abf Avoid allocating memory on the heap in HashUtils.
Return digests by value instead.
2016-12-02 09:04:52 -10:00
4b0fbf0735 Make combine_hashes more efficient. 2016-12-02 06:05:12 -10:00
5baca83454 Simplify code in HashUtils. 2016-12-02 16:48:30 +01:00
a1968efbfc Implement Iterator and IntoIterator for MerkleTree. 2016-12-02 16:39:00 +01:00
261649beca Fix naming from digest to algorithm in documentation.
Thanks @Liamsi for catching that.
2016-11-30 00:37:14 +01:00
872c52c093 Update documentation. 2016-11-29 22:55:07 +01:00
98634936fb Flag release. 2016-11-29 22:41:41 +01:00
4503258724 Port to ring. (#15) 2016-11-29 21:38:47 +01:00
e621241f2f Removing MerkleTree::from_vec_unsafe. (#13)
We can leave it up to the developer to implement the unwrap behaviour.
2016-11-24 10:06:10 +01:00
60ec820139 Add a few benchmarks (#6) 2016-11-22 21:53:34 +01:00
3dc25ad640 Fix a bug where Lemma would be unserialized incorrectly. 2016-11-21 23:01:35 +01:00
2176200d3d Test the Protobuf serialization. 2016-11-21 23:01:31 +01:00
011c10cd81 Add value back to Proof. 2016-11-21 22:22:37 +01:00
b395f224f5 Protocol Buffers (#9)
* Add protocol buffer messages for Proof and Lemma.

* Implement Protobuf serialization for Proof and Lemma.

* Implement Protobuf unserialization for Proof and Lemma.

* Add write_to_bytes and parse_from_bytes methods to Proof.

* Put the Protobuf-related code behind a feature flag.

* Enable more flags. See #10

* Fix clippy warnings. See #10
2016-11-21 17:18:41 +01:00
28d7824b8c Update documentation. 2016-11-20 23:17:39 +01:00
2593789b0a Enable warn(missing_docs) and add missing docs. 2016-11-20 23:17:39 +01:00
85902b746e Rename MerkleTree { tree => root } and Tree::{ get_hash() -> hash() } 2016-11-20 23:17:39 +01:00
dcad867978 Rename MerkleTree::from_vec to MerkleTree::from_vec_unsafe and add a safe version. 2016-11-20 23:17:39 +01:00
802af75c93 Remove Positioned::Nowhere. 2016-11-20 23:17:39 +01:00
89adaf0b4e Cleanup tests a bit. 2016-11-20 23:17:39 +01:00
c11019b485 Rename ProofBlock to Lemma, and hide Proof and Lemma's fields. 2016-11-20 23:17:39 +01:00
444fbec6b1 Update documentation. 2016-11-18 13:28:56 +01:00
995a67f985 Only export MerkleTree and Proof. 2016-11-18 13:28:55 +01:00
847cb7c275 Adding Crates.io (#3)
* Adding Cargo required fields.

* Adding Crates.io badge.
2016-11-17 12:10:18 +01:00
b4cd7537b5 Implement inclusion proof generation and verification. 2016-11-16 15:34:29 +01:00
8c2ee9538f Remove Hashable to use Into. Close #2 2016-11-15 17:25:25 +01:00
0eb8ba7a65 revert double reversing 2016-11-11 20:31:17 +01:00
b5f13cbadf fix link oops 2016-11-11 20:19:32 +01:00
0e042a02a5 update readme with docs and bug reporting 2016-11-11 20:17:32 +01:00
9e51e4c3f9 fix docs directory 2016-11-11 19:47:02 +01:00
204a450388 RustDoc 2016-11-11 19:40:10 +01:00
a0497ec4ad docs 2016-11-11 19:39:07 +01:00
a57d0c803e Merge branch 'master' of https://github.com/SpinResearch/merkle.rs 2016-11-11 16:45:32 +01:00
1a07c3e42b more separation of concerns 2016-11-11 16:44:52 +01:00
90531513fe Fix height for singleton tree. 2016-11-11 16:38:36 +01:00
93a2839ad1 Cleanup a test. 2016-11-11 16:36:16 +01:00
9369ef3663 split into files 2016-11-11 16:26:39 +01:00
cb787aeec1 move impl for Hashable out of lib + &str test 2016-11-11 15:56:17 +01:00
ac47293cdf Update tests. 2016-11-11 15:11:33 +01:00
de4a0a1572 Cleanup tests a bit. 2016-11-11 14:18:03 +01:00
6634a824c5 Add README, LICENSE, and setup Travis. 2016-11-11 14:09:55 +01:00