Skip to content

GramThanos/falcon.js

Repository files navigation

falcon.js

Fast-Fourier Lattice-based Compact Signatures over NTRU (FALCON) in JavaScript.

FALCON is a NIST Post-Quantum Cryptography Competition round three finalist.

Based on official Falcon implementation as submitted on NIST competition round 3 code. Compiled with emscripten and methods exposed through custom C wrappers. Wrapper influenced from ntru.js's wrapper.


Usage

Add library on your project:

<script type="text/javascript" src="falcon.js"></script>

Generate key pair:

falcon.keypair(1024).then((pair) => {
	console.log('Public Key', pair.publicKey);
	console.log('Private Key', pair.privateKey);
}).catch((error) => {
	console.log('Failed to create keypair', error);
});

Sign a message:

falcon.sign('My message', pair.privateKey, 1024).then((signature) => {
	console.log('Signature', signature);
}).catch((error) => {
	console.log('Failed to generate signature', error);
});

Verify a signature:

falcon.verify('My message', signature, pair.publicKey, 1024).then((signature) => {
	console.log('Signature is valid');
}).catch((error) => {
	console.log('Failed to validate signature', error);
});

Build from source

Get FALCON C source:

rm -r ./falcon-impl
bash ./get.sh

Build falcon.js (requires Emscripten installed):

make clean
make

License

This project is under The MIT license. I do although appreciate attribute.

Copyright (c) 2017-2023 Grammatopoulos Athanasios-Vasileios

This project make use of the Falcon implementation that is also under an MIT license.


GramThanos DinoDevs

About

Fast-Fourier Lattice-based Compact Signatures over NTRU in JavaScript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages