PHPackages                             rht/merkle-tree - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rht/merkle-tree

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rht/merkle-tree
===============

An implementation of a Merkle Tree in PHP

2.0.0(5y ago)01.8k↓28.6%BSD-2-ClausePHPPHP &gt;=7.0

Since May 22Pushed 4y agoCompare

[ Source](https://github.com/rht/merkle-tree)[ Packagist](https://packagist.org/packages/rht/merkle-tree)[ RSS](/packages/rht-merkle-tree/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

Merkle Tree Implementation
==========================

[](#merkle-tree-implementation)

[![Build Status](https://camo.githubusercontent.com/0085d6d0b28b0df3d957e03ab9daa5ec328ed6f875fed03a283abd8c1470bc31/68747470733a2f2f7472617669732d63692e6f72672f706c656f6e61736d2f6d65726b6c652d747265652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/pleonasm/merkle-tree)[![Coverage Status](https://camo.githubusercontent.com/90018ab00bb5b67b213c4c68fe583e268b5fd212e6512764c04ade025a43868e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f706c656f6e61736d2f6d65726b6c652d747265652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/pleonasm/merkle-tree?branch=master)

This is an implementation of a hash tree or [Merkle Tree](http://en.wikipedia.org/wiki/Merkle_Tree)for PHP.

Install
-------

[](#install)

Install via [Composer](http://getcomposer.org) (make sure you have composer in your path or in your project).

Put the following in your package.json:

```
{
    "require": {
        "rht/merkle-tree": "*"
    }
}
```

Then run `composer install`.

Usage For A Fixed Size Tree
---------------------------

[](#usage-for-a-fixed-size-tree)

Usage of a hash tree requires a user to provide a hashing function that each node will use to do its hashing. This function must accept a single string argument and must always return a string. It should never throw an exception.

If desired, you can also provide a callback for when the entire hash tree has been actually finished, rather than checking for it each time yourself.

```
