PHP code example of richjenks / merkle
1. Go to this page and download the library: Download richjenks/merkle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
richjenks / merkle example snippets
use RichJenks\Merkle\Merkle;
$data = [
'8c14f0db3df150123e6f3dbbf30f8b955a8249b62ac1d1ff16284aefa3d06d87',
'fff2525b8931402dd09222c50775608f75787bd2b87e56995a7bdd30f79702c4',
'6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4',
'e9a66845e05d5abc0ad04ec80f774a7e585c6e8db975962d069a522137b80c1d',
];
$root = Merkle::root($data);
// 6657A9252AACD5C0B2940996ECFF952228C3067CC38D4885EFB5A4AC4247E9F3
if ($merkle::verify($root, $data)) {
// Data hasn't been tampered with
} else {
// Naughty naughty...
}