sphincs-legacy
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

sphincs-legacy

Note

The original SPHINCS algorithm is no longer recommended. Instead prefer SPHINCS+, which has been selected by NIST for standardization. An implementation of SPHINCS+ is provided by sphincs.


Overview

The SPHINCS post-quantum cryptographic signing scheme compiled to WebAssembly using Emscripten. A simple JavaScript wrapper is provided to make SPHINCS easy to use in Web applications.

N.B. Unless interoperability with other SPHINCS implementations is a hard requirement, it is recommended to use supersphincs-legacy instead.

Example Usage

import {sphincs} from 'sphincs-legacy';

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

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

/* Combined signatures */

const signed /*: Uint8Array */ =
	await sphincs.sign(message, keyPair.privateKey)
;

const verified /*: Uint8Array */ =
	await sphincs.open(signed, keyPair.publicKey) // same as message
;

/* Detached signatures */

const signature /*: Uint8Array */ =
	await sphincs.signDetached(message, keyPair.privateKey)
;

const isValid /*: boolean */ =
	await sphincs.verifyDetached(signature, message, keyPair.publicKey) // true
;

console.log(keyPair);
console.log(message);
console.log(signed);
console.log(verified);
console.log(signature);
console.log(isValid);

Package Sidebar

Install

npm i sphincs-legacy

Weekly Downloads

3

Version

1.0.4

License

MIT

Unpacked Size

122 kB

Total Files

9

Last publish

Collaborators

  • cyphinc