Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("computes tree hashes of Uint8Array bodies < 1 MB", async () => {
const treeHash = new TreeHash(Sha256, fromUtf8);
treeHash.update(fromUtf8("bar"));
const results = await treeHash.digest();
expect(toHex(results)).toEqual(
"fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9"
);
});
export function fromUtf8(input: string): Uint8Array {
if (isNode()) {
return nodeFromUtf8(input);
}
return browserFromUtf8(input);
}