hypi_merkletree 2.0.2 copy "hypi_merkletree: ^2.0.2" to clipboard
hypi_merkletree: ^2.0.2 copied to clipboard

A Dart implementation of the merkle tree able to construct and verify merkle trees.

example/example.dart

import 'dart:typed_data';

import 'package:hypi_merkletree/hypi_merkletree.dart';
import 'package:pointycastle/pointycastle.dart';

void main() {
  Uint8List sha256(Uint8List data) {
    var sha256 = Digest('SHA-256');
    return sha256.process(data);
  }

  Uint8List sha3(Uint8List data) {
    var sha3 = Digest('SHA-3/256');
    return sha3.process(data);
  }

  var leaves = ['a', 'b', 'c']
      .map((x) => Uint8List.fromList(x.codeUnits))
      .map((x) => sha3(x))
      .toList();
  var tree = MerkleTree(leaves: leaves, hashAlgo: sha256);
}
3
likes
155
points
30
downloads

Publisher

verified publisherhypi.io

Weekly Downloads

A Dart implementation of the merkle tree able to construct and verify merkle trees.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

buffer, convert, meta

More

Packages that depend on hypi_merkletree