Skip to main content

createDiffieHellman

function createDiffieHellman
Jump to headingcreateDiffieHellman(
primeLength: number,
generator?: number,
): 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.

Parameters Jump to heading

Jump to headingprimeLength: number
optional
Jump to headinggenerator: number = 2

Return Type Jump to heading

Jump to headingcreateDiffieHellman(
prime: ArrayBuffer | ArrayBufferView,
generator?:
number
| ArrayBuffer
| ArrayBufferView
,
): DiffieHellman

Parameters Jump to heading

Jump to headingprime: ArrayBuffer | ArrayBufferView
optional
Jump to headinggenerator:
number
| ArrayBuffer
| ArrayBufferView

Return Type Jump to heading

Jump to headingcreateDiffieHellman(
prime: ArrayBuffer | ArrayBufferView,
generator: string,
generatorEncoding: BinaryToTextEncoding,
): DiffieHellman

Parameters Jump to heading

Jump to headingprime: ArrayBuffer | ArrayBufferView
Jump to headinggenerator: string

Return Type Jump to heading

Jump to headingcreateDiffieHellman(
prime: string,
primeEncoding: BinaryToTextEncoding,
generator?:
number
| ArrayBuffer
| ArrayBufferView
,
): DiffieHellman

Parameters Jump to heading

Jump to headingprime: string
optional
Jump to headinggenerator:
number
| ArrayBuffer
| ArrayBufferView

Return Type Jump to heading

Jump to headingcreateDiffieHellman(
prime: string,
primeEncoding: BinaryToTextEncoding,
generator: string,
generatorEncoding: BinaryToTextEncoding,
): DiffieHellman
Back to top