Skip to content

Latest commit

 

History

History
61 lines (33 loc) · 926 Bytes

readme.md

File metadata and controls

61 lines (33 loc) · 926 Bytes

Web Assembly Demo

A basic example of using the pqc_dilithium npm module

Installation

From this folder:

npm install

Run

npm run start

The demo is at localhost:8080

Library Usage

import * as dilithium from "pqc_dilithium";

// Generate Keypair
let keys = dilithium.keypair();
const pubKey = keys.pubkey;
const privKey = keys.secret;

// Sign a message
const msg = new TextEncoder().encode("message")
let sign = keys.sign(msg);

// Verify a signature

let result = dilithium.verify(sign, msg, pubKey)

var assert = require('assert');

assert.equal(result, true)

// Valid input lengths are found in the `Params` class
assert.equal(pubKey.length, kyber.Params.publicKeyBytes);
assert.equal(privKey.length, kyber.Params.secretKeyBytes);
assert.equal(sign.length,  kyber.Params.signBytes);