HashId

Pre-imported in crypto package and as simple as:

// constructing from binary byte or a string, utf8 will be applied
let x = crypto.HashId.of("hello, world");

// from a binary digest
let y = crypto.HashId.withDigest(x.digest);

// from a base64 encoded digest
let z = crypto.HashId.withBase64Digest(x.base64);

// get the binary digest (Uint8Array)
console.log(x.digest);

// get the string digest (base64)
console.log(x.base64);

// Check digests are equal
assert(x.equals(y));
assert(z.equals(x));