micro-rsa-dsa-dh
Version:
Minimal implementation of older cryptography algorithms: RSA, DSA, DH, ElGamal
26 lines • 752 B
TypeScript
export type ElGamalParams = {
p: bigint;
g: bigint;
};
export declare function genElGamalParams(bits: number): ElGamalParams;
export declare const ElGamal: ({ p, g }: ElGamalParams) => {
randomPrivateKey(): bigint;
getPublicKey(privateKey: bigint): bigint;
encrypt(publicKey: bigint, message: bigint, nonce?: bigint): {
ct1: bigint;
ct2: bigint;
};
decrypt(privateKey: bigint, ciphertext: {
ct1: bigint;
ct2: bigint;
}): bigint;
sign(privateKey: bigint, message: bigint, nonce?: bigint): {
r: bigint;
s: bigint;
};
verify(publicKey: bigint, message: bigint, sig: {
r: bigint;
s: bigint;
}): boolean;
};
//# sourceMappingURL=elgamal.d.ts.map