定制 mohamedahmed01/simple-merkele 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mohamedahmed01/simple-merkele

Composer 安装命令:

composer require mohamedahmed01/simple-merkele

包简介

package to generate and verify hashs using merkle tree

README 文档

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 :

Method Description
SimpleMerkele($mode,$algo) Creates new instance with the specified configuration
addHash($hash) add hash to the internal inventory not that once added cannot be removed
calculateTree() create the tree and the top node i.e hash
resetTree() reset the internal memories to be able to add new hashes and create new tree

Configuration :

Flag/Param Description
SimpleMerkele::ALLOW_ODD_ARRAYS Allow odd length trees but adjusting the pairing internally
SimpleMerkele::DIS_ALLOW_ODD_ARRAYS throws an exceptions on odd length tree
$algo accept standard algo type i.e "md5","sha256" refer to HashValidation class for full list

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.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固