mac.update(data[, inputEncoding])
data<string> | <Buffer> | <TypedArray> | <DataView>inputEncoding<string>data字符串的 编码。- 返回:Mac
用 data 更新 MAC 并返回 Mac 对象,以便可以链式调用。当 data 是字符串时,inputEncoding 默认为 'utf8'。当 data 是 Buffer、TypedArray 或 DataView 时,inputEncoding 会被忽略。
🌐 Updates the MAC with data and returns the Mac object so that calls can be
chained. When data is a string, inputEncoding defaults to 'utf8'. When
data is a Buffer, TypedArray, or DataView, inputEncoding is
ignored.
在最终确定之前,这个方法可以被多次调用。如果底层的 MAC 更新失败,Mac 对象将无法再次使用。在之前的底层 MAC 更新失败后或者在最终确定之后调用这个方法会抛出 ERR_CRYPTO_MAC_FINALIZED。
🌐 This method can be called multiple times before finalization. If an underlying
MAC update fails, the Mac object cannot be used again. Calling this method
after a previous underlying MAC update failure or after finalization throws
ERR_CRYPTO_MAC_FINALIZED.