Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dilithium-crystals

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dilithium-crystals

JavaScript wrapper for a WebAssembly build of Dilithium

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

dilithium-crystals

Overview

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

The default parameter set is Dilithium5 (roughly 256-bit strength).

N.B. Unless interoperability with other Dilithium implementations is a hard requirement, it is recommended to use superdilithium instead.

Example Usage

import {dilithium} from 'dilithium-crystals';

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

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

/* Combined signatures */

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

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

/* Detached signatures */

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

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

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

Keywords

FAQs

Package last updated on 17 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc