crypto.createDiffieHellman(prime[, primeEncoding][, generator][, generatorEncoding])
prime
<string> | <Buffer> | <TypedArray> | <DataView>primeEncoding
<string>prime
字符串的编码。generator
<number> | <string> | <Buffer> | <TypedArray> | <DataView> 默认值:2
generatorEncoding
<string>generator
字符串的编码。- 返回: <DiffieHellman>
使用提供的 prime
和可选的特定 generator
创建 DiffieHellman
密钥交换对象。
generator
参数可以是数字、字符串或 Buffer
。
如果未指定 generator
,则使用值 2
。
如果指定了 primeEncoding
,则 prime
应该是字符串;否则应为 Buffer
、TypedArray
或 DataView
。
如果指定了 generatorEncoding
,则 generator
应该是字符串;否则应为数字 Buffer
、TypedArray
或 DataView
。
prime
<string> | <Buffer> | <TypedArray> | <DataView>primeEncoding
<string> The encoding of theprime
string.generator
<number> | <string> | <Buffer> | <TypedArray> | <DataView> Default:2
generatorEncoding
<string> The encoding of thegenerator
string.- Returns: <DiffieHellman>
Creates a DiffieHellman
key exchange object using the supplied prime
and an
optional specific generator
.
The generator
argument can be a number, string, or Buffer
. If
generator
is not specified, the value 2
is used.
If primeEncoding
is specified, prime
is expected to be a string; otherwise
a Buffer
, TypedArray
, or DataView
is expected.
If generatorEncoding
is specified, generator
is expected to be a string;
otherwise a number, Buffer
, TypedArray
, or DataView
is expected.