cipher.update(data[, inputEncoding][, outputEncoding])
data
<string> | <Buffer> | <TypedArray> | <DataView>inputEncoding
<string> 数据的编码。outputEncoding
<string> 返回值的编码。- 返回: <Buffer> | <string>
使用 data
更新密码。
如果给定了 inputEncoding
参数,则 data
参数是使用指定编码的字符串。
如果未给定 inputEncoding
参数,则 data
必须是 Buffer
、TypedArray
或 DataView
。
如果 data
是 Buffer
、TypedArray
或 DataView
,则忽略 inputEncoding
。
outputEncoding
指定加密数据的输出格式。
如果指定了 outputEncoding
,则返回使用指定编码的字符串。
如果未提供 outputEncoding
,则返回 Buffer
。
可以使用新数据多次调用 cipher.update()
方法,直到调用 cipher.final()
。
在 cipher.final()
之后调用 cipher.update()
将导致抛出错误。
data
<string> | <Buffer> | <TypedArray> | <DataView>inputEncoding
<string> The encoding of the data.outputEncoding
<string> The encoding of the return value.- Returns: <Buffer> | <string>
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.