Module basic module

Module hash

Information digest calculation module, which can be used to calculate information digest and digest signature

Static function

digest

Create an information summary operation object according to the specified algorithm ID

1 2
static Digest hash.digest(Integer algo, Buffer data);

Call parameters:

  • algo : Integer, specify digest calculation algorithm
  • data : Buffer , create binary data that is updated at the same time

Return result:

  • Digest , returns the constructed information digest object

Create an information summary operation object according to the specified algorithm ID

1
static Digest hash.digest(Integer algo);

Call parameters:

  • algo : Integer, specify digest calculation algorithm

Return result:

  • Digest , returns the constructed information digest object

md2

Create an MD2 information summary object

1
static Digest hash.md2(Buffer data);

Call parameters:

  • data : Buffer , create binary data that is updated at the same time

Return result:

  • Digest , returns the constructed information digest object

md4

Create an MD4 information summary object

1
static Digest hash.md4(Buffer data);

Call parameters:

  • data : Buffer , create binary data that is updated at the same time

Return result:

  • Digest , returns the constructed information digest object

md5

Create an MD5 information summary object

1
static Digest hash.md5(Buffer data);

Call parameters:

  • data : Buffer , create binary data that is updated at the same time

Return result:

  • Digest , returns the constructed information digest object

sha1

Create a SHA1 information digest object

1
static Digest hash.sha1(Buffer data);

Call parameters:

  • data : Buffer , create binary data that is updated at the same time

Return result:

  • Digest , returns the constructed information digest object

sha224

Create a SHA224 information digest object

1
static Digest hash.sha224(Buffer data);

Call parameters:

  • data : Buffer , create binary data that is updated at the same time

Return result:

  • Digest , returns the constructed information digest object

sha256

Create a SHA256 information digest object

1
static Digest hash.sha256(Buffer data);

Call parameters:

  • data : Buffer , create binary data that is updated at the same time

Return result:

  • Digest , returns the constructed information digest object

sha384

Create a SHA384 message digest object

1
static Digest hash.sha384(Buffer data);

Call parameters:

  • data : Buffer , create binary data that is updated at the same time

Return result:

  • Digest , returns the constructed information digest object

sha512

Create a SHA512 information digest object

1
static Digest hash.sha512(Buffer data);

Call parameters:

  • data : Buffer , create binary data that is updated at the same time

Return result:

  • Digest , returns the constructed information digest object

ripemd160

Create a RIPEMD160 information summary object

1
static Digest hash.ripemd160(Buffer data);

Call parameters:

  • data : Buffer , create binary data that is updated at the same time

Return result:

  • Digest , returns the constructed information digest object

sm3

Create an SM3 information summary object

1
static Digest hash.sm3(Buffer data);

Call parameters:

  • data : Buffer , create binary data that is updated at the same time

Return result:

  • Digest , returns the constructed information digest object

hmac

Create an information digest signature object based on the specified algorithm identifier

1 2
static Digest hash.hmac(Integer algo, Buffer key);

Call parameters:

  • algo : Integer, specify digest calculation algorithm
  • key : Buffer , binary signature key

Return result:

  • Digest , returns the constructed information digest object

hmac_md2

Create an MD2 message digest signature object

1
static Digest hash.hmac_md2(Buffer key);

Call parameters:

  • key : Buffer , binary signature key

Return result:

  • Digest , returns the constructed information digest object

hmac_md4

Create an MD4 message digest signature object

1
static Digest hash.hmac_md4(Buffer key);

Call parameters:

  • key : Buffer , binary signature key

Return result:

  • Digest , returns the constructed information digest object

hmac_md5

Create an MD5 message digest signature object

1
static Digest hash.hmac_md5(Buffer key);

Call parameters:

  • key : Buffer , binary signature key

Return result:

  • Digest , returns the constructed information digest object

hmac_sha1

Create a SHA1 message digest signature object

1
static Digest hash.hmac_sha1(Buffer key);

Call parameters:

  • key : Buffer , binary signature key

Return result:

  • Digest , returns the constructed information digest object

hmac_sha224

Create a SHA224 message digest signature object

1
static Digest hash.hmac_sha224(Buffer key);

Call parameters:

  • key : Buffer , binary signature key

Return result:

  • Digest , returns the constructed information digest object

hmac_sha256

Create a SHA256 message digest signature object

1
static Digest hash.hmac_sha256(Buffer key);

Call parameters:

  • key : Buffer , binary signature key

Return result:

  • Digest , returns the constructed information digest object

hmac_sha384

Create a SHA384 message digest signature object

1
static Digest hash.hmac_sha384(Buffer key);

Call parameters:

  • key : Buffer , binary signature key

Return result:

  • Digest , returns the constructed information digest object

hmac_sha512

Create a SHA512 message digest signature object

1
static Digest hash.hmac_sha512(Buffer key);

Call parameters:

  • key : Buffer , binary signature key

Return result:

  • Digest , returns the constructed information digest object

hmac_ripemd160

Create a RIPEMD160 message digest signature object

1
static Digest hash.hmac_ripemd160(Buffer key);

Call parameters:

  • key : Buffer , binary signature key

Return result:

  • Digest , returns the constructed information digest object

hmac_sm3

Create an SM3 message digest signature object

1
static Digest hash.hmac_sm3(Buffer key);

Call parameters:

  • key : Buffer , binary signature key

Return result:

  • Digest , returns the constructed information digest object

constant

MD2

MD2 message digest algorithm identification constant

1
const hash.MD2 = 1;

MD4

MD4 message digest algorithm identification constant

1
const hash.MD4 = 2;

MD5

MD5 message digest algorithm identification constant

1
const hash.MD5 = 3;

SHA1

SHA1 message digest algorithm identification constant

1
const hash.SHA1 = 4;

SHA224

SHA224 message digest algorithm identification constant

1
const hash.SHA224 = 5;

SHA256

SHA256 message digest algorithm identification constant

1
const hash.SHA256 = 6;

SHA384

SHA384 message digest algorithm identification constant

1
const hash.SHA384 = 7;

SHA512

SHA512 message digest algorithm identification constant

1
const hash.SHA512 = 8;

RIPEMD160

RIPEMD160 Information digest algorithm identification constant

1
const hash.RIPEMD160 = 9;

SM3

SM3 message digest algorithm identification constant

1
const hash.SM3 = 10;