Skip to content

Instantly share code, notes, and snippets.

@johnson86tw
Created June 14, 2021 05:20
Show Gist options
  • Save johnson86tw/0d8bc152b3865403581e5e8aa10e01a6 to your computer and use it in GitHub Desktop.
Save johnson86tw/0d8bc152b3865403581e5e8aa10e01a6 to your computer and use it in GitHub Desktop.
const circomlib = require("circomlib");
const mimcsponge = circomlib.mimcsponge;
export function MiMCSponge(left: string, right: string): string {
return mimcsponge.multiHash([BigInt(left), BigInt(right)]).toString();
}
export interface IMerkleTree {
root: () => string;
proof: (index: number) => {
root: string;
pathElements: string[];
pathIndices: number[];
leaf: string;
};
insert: (leaf: string) => void;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment