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
2static Digest hash.digest(Integer algo,
Buffer data = NULL);
Call parameters:
- algo: Integer, specify the digest calculation algorithm
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
md2
Create an MD2 information summary object
1static Digest hash.md2(Buffer data = NULL);
Call parameters:
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
md4
Create an MD4 information summary object
1static Digest hash.md4(Buffer data = NULL);
Call parameters:
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
md5
Create an MD5 information summary object
1static Digest hash.md5(Buffer data = NULL);
Call parameters:
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
sha1
Create a SHA1 information digest object
1static Digest hash.sha1(Buffer data = NULL);
Call parameters:
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
sha224
Create a SHA224 information digest object
1static Digest hash.sha224(Buffer data = NULL);
Call parameters:
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
sha256
Create a SHA256 information digest object
1static Digest hash.sha256(Buffer data = NULL);
Call parameters:
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
sha384
Create a SHA384 information digest object
1static Digest hash.sha384(Buffer data = NULL);
Call parameters:
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
sha512
Create a SHA512 information digest object
1static Digest hash.sha512(Buffer data = NULL);
Call parameters:
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
ripemd160
Create a RIPEMD160 information summary object
1static Digest hash.ripemd160(Buffer data = NULL);
Call parameters:
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
sm3
Create an SM3 information summary object
1static Digest hash.sm3(Buffer data = NULL);
Call parameters:
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
Create an SM3 information summary operation object and preprocess it
1
2
3static Digest hash.sm3(PKey pubKey,
String id,
Buffer data = NULL);
Call parameters:
- pubKey: PKey, Signature public key
- id: String, signature ID
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
hmac
Create an information digest signature operation object according to the specified algorithm identifier
1
2
3static Digest hash.hmac(Integer algo,
Buffer key,
Buffer data = NULL);
Call parameters:
- algo: Integer, specify the digest calculation algorithm
- key: Buffer, Binary signature key
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
hmac_md2
Create an MD2 message digest signature object
1
2static Digest hash.hmac_md2(Buffer key,
Buffer data = NULL);
Call parameters:
- key: Buffer, Binary signature key
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
hmac_md4
Create an MD4 message digest signature object
1
2static Digest hash.hmac_md4(Buffer key,
Buffer data = NULL);
Call parameters:
- key: Buffer, Binary signature key
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
hmac_md5
Create an MD5 message digest signature object
1
2static Digest hash.hmac_md5(Buffer key,
Buffer data = NULL);
Call parameters:
- key: Buffer, Binary signature key
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
hmac_sha1
Create a SHA1 message digest signature object
1
2static Digest hash.hmac_sha1(Buffer key,
Buffer data = NULL);
Call parameters:
- key: Buffer, Binary signature key
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
hmac_sha224
Create a SHA224 message digest signature object
1
2static Digest hash.hmac_sha224(Buffer key,
Buffer data = NULL);
Call parameters:
- key: Buffer, Binary signature key
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
hmac_sha256
Create a SHA256 message digest signature object
1
2static Digest hash.hmac_sha256(Buffer key,
Buffer data = NULL);
Call parameters:
- key: Buffer, Binary signature key
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
hmac_sha384
Create a SHA384 message digest signature object
1
2static Digest hash.hmac_sha384(Buffer key,
Buffer data = NULL);
Call parameters:
- key: Buffer, Binary signature key
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
hmac_sha512
Create a SHA512 message digest signature object
1
2static Digest hash.hmac_sha512(Buffer key,
Buffer data = NULL);
Call parameters:
- key: Buffer, Binary signature key
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
hmac_ripemd160
Create a RIPEMD160 message digest signature object
1
2static Digest hash.hmac_ripemd160(Buffer key,
Buffer data = NULL);
Call parameters:
- key: Buffer, Binary signature key
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
hmac_sm3
Create an SM3 message digest signature object
1
2static Digest hash.hmac_sm3(Buffer key,
Buffer data = NULL);
Call parameters:
- key: Buffer, Binary signature key
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
Create an SM3 message digest signature object and preprocess it
1
2
3
4static Digest hash.hmac_sm3(PKey pubKey,
String id,
Buffer key,
Buffer data = NULL);
Call parameters:
- pubKey: PKey, Signature public key
- id: String, signature ID
- key: Buffer, Binary signature key
- data: Buffer, Create binary data that is updated at the same time, the default is null, and the data is not updated
Return result:
- Digest, Returns the constructed information summary object
constant
MD2
MD2 message digest algorithm identification constant
1const hash.MD2 = 1;
MD4
MD4 message digest algorithm identification constant
1const hash.MD4 = 2;
MD5
MD5 message digest algorithm identification constant
1const hash.MD5 = 3;
SHA1
SHA1 message digest algorithm identification constant
1const hash.SHA1 = 4;
SHA224
SHA224 message digest algorithm identification constant
1const hash.SHA224 = 5;
SHA256
SHA256 message digest algorithm identification constant
1const hash.SHA256 = 6;
SHA384
SHA384 message digest algorithm identification constant
1const hash.SHA384 = 7;
SHA512
SHA512 message digest algorithm identification constant
1const hash.SHA512 = 8;
RIPEMD160
RIPEMD160 Information digest algorithm identification constant
1const hash.RIPEMD160 = 9;
SM3
SM3 message digest algorithm identification constant
1const hash.SM3 = 10;