cipher.update(data[, inputEncoding][, outputEncoding])


data更新密码。如果给出了inputEncoding的论证,它的值必须是'utf8', 'ascii', 或者'latin1',而data参数是使用指定编码的字符串。如果不给出inputEncoding的参数,则data必须是BufferTypedArray, 或者DataView。如果data是一个BufferTypedArray, 或者 DataView, 那么inputEncoding就被忽略了。

outputEncoding指定了加密数据的输出格式,可以是'latin1''base64' 或者 'hex'。如果指定了outputEncoding,则返回使用指定编码的字符串。如果没有outputEncoding被提供,会返回Buffer

cipher.update()方法可以用新数据多次调用,直到cipher.final()被调用。 [' cipher.final()'][]。在cipher.final()之后调用cipher.update()将抛出错误。

Updates the cipher with data. If the inputEncoding argument is given, the data argument is a string using the specified encoding. If the inputEncoding argument is not given, data must be a Buffer, TypedArray, or DataView. If data is a Buffer, TypedArray, or DataView, then inputEncoding is ignored.

The outputEncoding specifies the output format of the enciphered data. If the outputEncoding is specified, a string using the specified encoding is returned. If no outputEncoding is provided, a Buffer is returned.

The cipher.update() method can be called multiple times with new data until cipher.final() is called. Calling cipher.update() after cipher.final() will result in an error being thrown.