* Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} * @param {Encoding=} encoding encoding of the return value * @returns {string | Buffer} digest
(encoding)
| 99 | * @returns {string | Buffer} digest |
| 100 | */ |
| 101 | digest(encoding) { |
| 102 | if (this.string !== undefined) { |
| 103 | if (this.encoding) { |
| 104 | update(this.hash, this.string, this.encoding); |
| 105 | } else { |
| 106 | update(this.hash, this.string); |
| 107 | } |
| 108 | } |
| 109 | if (!encoding) { |
| 110 | return digest(this.hash); |
| 111 | } |
| 112 | return digest(this.hash, encoding); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | module.exports = BatchedHash; |