Skip to content

ChainSafe/hashtree-z

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hashtree-z

Zig binding for hashtree

How to build

  • zig build
  • locate zig-out/lib/libhashtree-z.dylib (could be diffrerent name in other OSs) and continue the test below

How to consume at javascript side using Bun FFI:

import {dlopen} from "bun:ffi";

// Link to shared library path
const path = `.${your_path}/libhashtree-z.dylib`;

// Load the compiled Zig shared library
const lib = dlopen(path, {
  hash: {
      args: ["ptr", "ptr", "u64"],
      returns: "void"
  },
});

const chunk = new Uint8Array(64).fill(0xAB);
const out = new Uint8Array(32);

lib.symbols.hash(out, chunk, 1);
console.log("out", out);

// Close the library when done
lib.close();

About

Zig binding for hashtree

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Assembly 51.5%
  • C++ 22.8%
  • C 13.7%
  • Go 6.9%
  • Rust 1.6%
  • Makefile 1.4%
  • Other 2.1%