Object built-in object

Object Digest

Information summary object

Inheritance

#lineWidth: 1.5 #font: Helvetica,sans-Serif #fontSize: 10 #leading: 1.6 #.this: fill=lightgray #.class: fill=white [<class>object|toString();toJSON()] [<this>Digest|size|update();digest();sign();verify()] [object] <:- [Digest] Digest size update() digest() sign() verify() object toString() toJSON()

Member attributes

size

Integer, query the number of digest bytes of the current information digest algorithm

1
readonly Integer Digest.size;

Member function

update

Update binary summary information

1
Digest Digest.update(Buffer data);

Call parameters:

  • data: Buffer, Binary data block

Return result:

  • Digest, Returns the information summary object itself

digest

Calculate and return summary

1
Value Digest.digest(String codec = "buffer");

Call parameters:

  • codec: String, specify the encoding format, allowed values ​​are: "buffer", "hex", "base64", "utf8", or iconv Character set supported by the module

Return result:

  • Value, Returns the summary representation of the specified encoding

sign

Sign and return summary

1
Buffer Digest.sign(PKey key) async;

Call parameters:

  • key: PKey, The signed private key

Return result:

  • Buffer, Return the signed data

verify

Verify that the signatures are consistent

1 2
Boolean Digest.verify(PKey key, Buffer sign) async;

Call parameters:

  • key: PKey, Verify the public key of the signature
  • sign: Buffer, Specify the signature to be verified

Return result:

  • Boolean, Return the verified result

toString

Returns the string representation of the object, generally returns "[Native Object]", the object can be re-implemented according to its own characteristics

1
String Digest.toString();

Return result:

  • String, Returns the string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object

1
Value Digest.toJSON(String key = "");

Call parameters:

  • key: String, unused

Return result:

  • Value, Returns a value containing JSON serializable