@mysten/sui
Version:
Sui TypeScript API(Work in Progress)
13 lines (12 loc) • 429 B
JavaScript
import { blake2b } from "@noble/hashes/blake2b";
function hashTypedData(typeTag, data) {
const typeTagBytes = Array.from(`${typeTag}::`).map((e) => e.charCodeAt(0));
const dataWithTag = new Uint8Array(typeTagBytes.length + data.length);
dataWithTag.set(typeTagBytes);
dataWithTag.set(data, typeTagBytes.length);
return blake2b(dataWithTag, { dkLen: 32 });
}
export {
hashTypedData
};
//# sourceMappingURL=hash.js.map