diffieHellman.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])
-
otherPublicKey
<string> | <ArrayBuffer> | <Buffer> | <TypedArray> | <DataView> -
inputEncoding
<string>otherPublicKey
字符串的 字符编码。¥
inputEncoding
<string> The encoding of anotherPublicKey
string.
使用 otherPublicKey
作为对方的公钥计算共享密钥,并返回计算出的共享密钥。使用指定的 inputEncoding
解释提供的密钥,使用指定的 outputEncoding
对密钥进行编码。如果未提供 inputEncoding
,则 otherPublicKey
应为 Buffer
、TypedArray
或 DataView
。
¥Computes the shared secret using otherPublicKey
as the other
party's public key and returns the computed shared secret. The supplied
key is interpreted using the specified inputEncoding
, and secret is
encoded using specified outputEncoding
.
If the inputEncoding
is not
provided, otherPublicKey
is expected to be a Buffer
,
TypedArray
, or DataView
.
如果给定 outputEncoding
,则返回一个字符串;否则,返回 Buffer
。
¥If outputEncoding
is given a string is returned; otherwise, a
Buffer
is returned.