Hash functions

let binaryDigest = crypto.diegst(hashType, data);

Here is an example:

let dd = crypto.digest(crypto.SHA256, "hello, world");
assert(btoa(dd) == "Ccp+TqpuiunH0mEWcSkYSINkTQffuny/vEyKLgg2DVs=");
  • data should be eqithe a binary Uint8Array instance or a string, in which case the UTF8 ecnoding will be applied.

returns binary digest, Uint8Array.

Supported hash types as for now are:

  • crypto.SHA256
  • crypto.SHA512
  • crypto.SHA3_256
  • crypto.SHA3_384
  • crypto.SHA3_512