* Update hash https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding * @param {string | Buffer} data data * @param {string=} inputEncoding data encoding * @returns {this} updated hash
(data, inputEncoding)
| 74 | * @returns {this} updated hash |
| 75 | */ |
| 76 | update(data, inputEncoding) { |
| 77 | if (typeof data === "string") { |
| 78 | while (data.length > MAX_SHORT_STRING) { |
| 79 | this._updateWithShortString( |
| 80 | data.slice(0, MAX_SHORT_STRING), |
| 81 | /** @type {NodeJS.BufferEncoding} */ |
| 82 | (inputEncoding) |
| 83 | ); |
| 84 | data = data.slice(MAX_SHORT_STRING); |
| 85 | } |
| 86 | this._updateWithShortString( |
| 87 | data, |
| 88 | /** @type {NodeJS.BufferEncoding} */ |
| 89 | (inputEncoding) |
| 90 | ); |
| 91 | return this; |
| 92 | } |
| 93 | this._updateWithBuffer(data); |
| 94 | return this; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Update with short string. |
no test coverage detected