Created
December 4, 2020 10:25
-
-
Save askaaqib/047454c0c3a5a555331f464dd81fb5fe to your computer and use it in GitHub Desktop.
MerkleRoot-From-Repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require "../vendor/autoload.php"; | |
$tree = new \Pleo\Merkle\FixedSizeTree( | |
2, | |
function($data){ | |
return hash('sha256', hash('sha256', $data, true), true); | |
}, | |
function($hash) { | |
echo implode('', unpack('H*', $hash)) . "\n"; | |
} | |
); | |
$tree->set(0, 'Science'); | |
$tree->set(1, 'is'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment