pqc_kyber wasm demo

import * as kyber from pqc_kyber

kyber.Params.publicKeyBytes:
kyber.Params.secretKeyBytes:
kyber.Params.ciphertextBytes:
kyber.Params.sharedSecretBytes:

var keys = kyber.keypair();
const publicKeyAlice = keys.pubkey;
const privateKeyAlice = keys.secret;


Public Key (Output):

Private Key (Output):

var enc = kyber.encapsulate(publicKeyAlice);
var ciphertextBob = enc.ciphertext;
var sharedSecretBob = enc.sharedSecret;


Public Key (Input):

Ciphertext (Output):

Shared Key (Output):

var dec = kyber.decapsulate(ciphertextBob, privateKeyAlice);
var sharedSecretAlice = dec.sharedSecret;
assert.equal(sharedSecretAlice, sharedSecretBob);


Private Key (Input):

Ciphertext (Input):

Shared Key (Output):