/cryptowasm

WebAssembly versions of secp256k1, ripemd160, sha256, sha512, and sha1

Primary LanguageTypeScriptMIT LicenseMIT

Cryptowasm

An ultra-lightweight JavaScript library exposing several cryptographic primitives commonly used in cryptocurrency

Cryptowasm has no dependencies and works in all JavaScript environments, including Node.js, Deno (probably), and browsers.

Purpose

Cryptowasm is a stripped-down fork of libauth by the very skillful bitjson, only including Secp256k1, sha1, sha256, sha512, and Ripemd160. No other utility tools or bitcoin(cash)-specific feature sets.

Getting Started

To get started, install cryptowasm:

npm install cryptowasm

And import the functionality you need:

import { instantiateSecp256k1 } from 'cryptowasm';
import { msgHash, pubkey, sig } from './somewhere';

(async () => {
  const secp256k1 = await instantiateSecp256k1();
  secp256k1.verifySignatureDERLowS(sig, pubkey, msgHash)
    ? console.log('🚀 Signature valid')
    : console.log('❌ Signature invalid');
})();

Stable API

The following APIs are considered stable, and will only include breaking changes in major version upgrades.

WebAssembly ECDSA & Schnorr

WebAssembly Hashing Functions