mohamedahmed01/simple-merkele

package to generate and verify hashs using merkle tree

v1.0.0beta1 2021-03-20 21:27 UTC

This package is auto-updated.

Last update: 2024-08-22 05:26:01 UTC


README

Latest Version on Packagist Build Status Quality Score Code Coverage

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

You can install the package via composer:

composer require mohamedahmed01/simple-merkele

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 :

Configuration :

Testing

composer test

Security

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

License

The MIT License (MIT). Please see License File for more information.