# sphincs

> JavaScript wrapper for a WebAssembly build of SPHINCS+

Latest version **3.0.4** (published 2023-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install sphincs
pnpm add sphincs
yarn add sphincs
bun add sphincs
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.4 |
| Published | 2023-07-17 |
| First published | 2017-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 90.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Cyph, Inc. |
| Maintainers | cyphinc |
| Keywords | cryptography, post-quantum, sphincs, asm.js, webassembly |

## Links

- npm: https://www.npmjs.com/package/sphincs
- Repository: https://github.com/cyph/pqcrypto.js
- Homepage: https://github.com/cyph/pqcrypto.js#readme
- Issues: https://github.com/cyph/pqcrypto.js/issues
- npm.io page: https://npm.io/package/sphincs

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 3.0.4 (latest) — 2023-07-17
- 2.3.0-next (next) — 2019-09-09
- 2.1.11-debug (debug) — 2018-06-20
- 3.0.3 — 2023-05-21
- 3.0.2 — 2023-01-26
- 3.0.1 — 2022-08-06
- 3.0.0 — 2022-07-13
- 2.4.3 — 2022-07-12
- 2.4.2 — 2022-07-11
- 2.4.1 — 2020-06-19
- 2.4.0 — 2020-02-01
- 2.3.2 — 2019-11-20
- 2.3.1 — 2019-09-13
- 2.3.0 — 2019-09-11
- 2.2.3 — 2018-10-22
- … 23 more at https://npm.io/package/sphincs/versions

## README

# sphincs

## Overview

The [SPHINCS+](https://sphincs.org) post-quantum cryptographic signing scheme
compiled to WebAssembly using [Emscripten](https://github.com/kripken/emscripten).
A simple JavaScript wrapper is provided to make SPHINCS+ easy to use in Web applications.

The default parameter set is SPHINCS+-SHAKE-256s-robust (roughly 256-bit strength).

N.B. Unless interoperability with other SPHINCS+ implementations is a hard requirement,
it is recommended to use
[supersphincs](https://github.com/cyph/pqcrypto.js/tree/master/packages/supersphincs) instead.

## Example Usage

	import {sphincs} from 'sphincs';

	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);

## Changelog

Breaking changes in major versions:

3.0.0:

* Upgraded from SPHINCS to SPHINCS+. For backwards compatibility with previous versions
of this package, use
[sphincs-legacy](https://github.com/cyph/pqcrypto.js/tree/master/packages/sphincs-legacy).

2.0.0:

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

---
_Source: https://npm.io/package/sphincs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
