Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rlee287/merkle-tree-checksum
https://github.com/rlee287/merkle-tree-checksum
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rlee287/merkle-tree-checksum
- Owner: rlee287
- License: mit
- Created: 2020-12-31T06:11:11.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-22T06:05:15.000Z (4 months ago)
- Last Synced: 2024-12-24T01:15:14.471Z (11 days ago)
- Language: Rust
- Size: 651 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# merkle-tree-checksum
This is a utility that computes a Merkle tree hash over the specified files. The advantage that a Merkle tree has over applying the hash once includes
* Hash parallelism (which is not taken advantage of yet)
* Precisely identifying which blocks have been corrupted## Hash Tree Structure
The file is first divided into blocks that are `block_length` bytes long, and each block is hashed to create the leaf nodes of the tree. Adjacent nodes at each layer are grouped into groups of `branch_factor` nodes, and a hash is computed for a parent node (with these nodes as children) by hashing the concatenation of the hashes in the children nodes. (A parent node may have less than `branch_factor` children when the total number of blocks is not a power of `branch_factor`.)
To address second pre-image attacks, we prepend the byte `0x00` before hashing data blocks, and prepend `0x01` before hashing the concatenation of node hashes. (This is the same data adjustment used in Certificate Transparency.)