micro-rsa-dsa-dh
Version:
Minimal implementation of older cryptography algorithms: RSA, DSA, DH, ElGamal
21 lines • 743 B
TypeScript
export type DHGroup = {
p: bigint;
g: bigint;
};
export declare const DHGroups: Record<string, DHGroup>;
/**
* Basic Diffie Hellman implementation with focus on simplicity.
* For now: non-constant time operations, no precomputes.
*
* We can speedup operations same way as in @noble/curves,
* but if re-key happens often it could be slow.
* @param group well-known modp group or {p: bigint, g: bigint};
* @returns
*/
export declare const DH: (group: keyof DHGroup | DHGroup) => {
randomPrivateKey(): Uint8Array;
getPublicKey(privateKey: Uint8Array): Uint8Array;
getSharedSecret(privateA: Uint8Array, publicB: Uint8Array): Uint8Array;
};
export declare const diffieHellman: typeof DH;
//# sourceMappingURL=dh.d.ts.map