Skip to content

JavaScript wrapper for a WebAssembly build of SIDH.

License

Notifications You must be signed in to change notification settings

relative-chaos/sidh.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sidh.js

Overview

The SIDH post-quantum asymmetric cipher compiled to WebAssembly using Emscripten. The specific implementation in use is from Microsoft Research. A simple JavaScript wrapper is provided to make SIDH easy to use in web applications.

The parameters are configured to 128-bit strength (SIKEp503).

Example Usage

(async () => {
	const keyPair /*: {privateKey: Uint8Array; publicKey: Uint8Array} */ =
		await sidh.keyPair()
	;

	const plaintext /*: Uint8Array */ =
		new Uint8Array([104, 101, 108, 108, 111, 0]) // "hello"
	;

	const encrypted /*: Uint8Array */ =
		await sidh.encrypt(plaintext, keyPair.publicKey)
	;

	const decrypted /*: Uint8Array */ =
		await sidh.decrypt(encrypted, keyPair.privateKey) // same as plaintext
	;

	console.log(keyPair);
	console.log(plaintext);
	console.log(encrypted);
	console.log(decrypted);
})();

Note: SIDH is a low-level cryptographic primitive, not a high-level construct like libsodium's crypto_box. This module can be combined with a symmetric cipher and a MAC to provide such a construct, but you should avoid using sidh.js directly for anything important if you lack the experience to do so.

Changelog

Breaking changes in major versions:

5.0.0:

  • Upgraded to SIDH 3.0 and built new API in line with mceliece.js and ntru.js.

4.0.0:

  • As part of upgrading from asm.js to WebAssembly (with asm.js included as a fallback), the API is fully asynchronous.

3.0.0:

  • Removed some undocumented functions as part of minor API cleanup.

2.0.0:

  • Upgraded to SIDH 2.0.

About

JavaScript wrapper for a WebAssembly build of SIDH.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 40.6%
  • Makefile 30.1%
  • C 29.3%