PHPackages                             mohamedahmed01/simple-merkele - 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. mohamedahmed01/simple-merkele

ActiveLibrary

mohamedahmed01/simple-merkele
=============================

package to generate and verify hashs using merkle tree

v1.0.0beta1(5y ago)00MITPHPPHP ^7.1

Since Mar 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/mohamedahmed01/simple-merkele)[ Packagist](https://packagist.org/packages/mohamedahmed01/simple-merkele)[ Docs](https://github.com/mohamedahmed01/simple-merkele)[ RSS](/packages/mohamedahmed01-simple-merkele/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Merkle Tree Algorithm Implementation using PHP
==============================================

[](#merkle-tree-algorithm-implementation-using-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f9bccb5c86b84e588e41eff11d38986e3db0e8f6c482b1ab9f042bfdb04fecc8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f68616d656461686d656430312f73696d706c652d6d65726b656c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mohamedahmed01/simple-merkele#v1.0.0beta1)[![Build Status](https://camo.githubusercontent.com/bcdf38fbabee139b2408722f66f72d090b2b3114f10b03205669bb4d9bd74b9b/68747470733a2f2f7472617669732d63692e636f6d2f6d6f68616d656461686d656430312f73696d706c652d6d65726b656c652e7376673f6272616e63683d6d61696e)](https://travis-ci.com/mohamedahmed01/simple-merkele)[![Quality Score](https://camo.githubusercontent.com/96a64f4eb1b0fb599806c0c25dc07999cdcee01e1a6f58e21f3b2b8eb6344770/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d6f68616d656461686d656430312f73696d706c652d6d65726b656c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/mohamedahmed01/simple-merkele)[![Code Coverage](https://camo.githubusercontent.com/747fa9d5602fe9821493cb385a5548d2d5a39ebba968b4a94071462517adee18/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6f68616d656461686d656430312f73696d706c652d6d65726b656c652f6261646765732f636f7665726167652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/mohamedahmed01/simple-merkele/?branch=main)

This is a very simple implemenation of merkle tree in which you can use multiple hashes to create a merkele tree and compress it to a single hash .

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require mohamedahmed01/simple-merkele
```

Usage
-----

[](#usage)

```
    //include SimpleMereke
    //prepare your array of hashes
    $hashsArray=[
            hash('sha256', 'hello'),
            hash('sha256', 'goodbye'),
            hash('sha256', 'topofthemorning'),
            hash('sha256', 'sionara'),
            hash('sha256', 'areviditche'),
            hash('sha256', 'arregato'),
        ];
    //create new instance of simpleMerkele
    $merkele = new SimpleMerkele();
    //add your hashes to the inventory
    foreach ($hashsArray as $hash) {
        $merkele->addHash($hash);
    }
    //create the top hash
    $merkele->calculateTree(); //9b8dd5dd1f56d5fa17a67c10b8891c57e51f5fd36fe3a2d7e290d605840332d8
    $merkele->resetTree();

```

### Methods :

[](#methods-)

MethodDescriptionSimpleMerkele($mode,$algo)Creates new instance with the specified configurationaddHash($hash)add hash to the internal inventory not that once added cannot be removedcalculateTree()create the tree and the top node i.e hashresetTree()reset the internal memories to be able to add new hashes and create new tree### Configuration :

[](#configuration-)

Flag/ParamDescriptionSimpleMerkele::ALLOW\_ODD\_ARRAYSAllow odd length trees but adjusting the pairing internallySimpleMerkele::DIS\_ALLOW\_ODD\_ARRAYSthrows an exceptions on odd length tree$algoaccept standard algo type i.e "md5","sha256" refer to HashValidation class for full list### Testing

[](#testing)

```
composer test
```

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1879d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/544700fcf45f5d03e02923ac2e9009264b0f8cafa12438135253da15e5e12fbb?d=identicon)[mohamedahmed01](/maintainers/mohamedahmed01)

---

Top Contributors

[![mohamedahmed01](https://avatars.githubusercontent.com/u/47615007?v=4)](https://github.com/mohamedahmed01 "mohamedahmed01 (20 commits)")

---

Tags

mohamedahmed01simple-merkele

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/mohamedahmed01-simple-merkele/health.svg)

```
[![Health](https://phpackages.com/badges/mohamedahmed01-simple-merkele/health.svg)](https://phpackages.com/packages/mohamedahmed01-simple-merkele)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
