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. (More specifically, the security level is 128 quantum bits and 192 classical bits.)
SECURITY NOTE: the scheme is NOT secure when using static keys. See Remark 1 of this paper.
(async () => {
const localKeyPair /*: {privateKey: Uint8Array; publicKey: Uint8Array} */ =
await sidh.keyPair()
;
const remoteKeyPair /*: {privateKey: Uint8Array; publicKey: Uint8Array} */ =
await sidh.keyPair()
;
const localSecret /*: Uint8Array */ =
await sidh.secret(remoteKeyPair.publicKey, localKeyPair.privateKey)
;
const remoteSecret /*: Uint8Array */ =
await sidh.secret(localKeyPair.publicKey, remoteKeyPair.privateKey)
;
// localSecret and remoteSecret are equal
console.log(localKeyPair);
console.log(remoteKeyPair);
console.log(localSecret);
console.log(remoteSecret);
})();
Note: This library only handles generating shared secrets; you'll need to handle key derivation and symmetric encryption from there.
Breaking changes in major versions:
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.