npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ala-ecc1

v1.6.1

Published

Elliptic curve cryptography functions

Downloads

4

Readme

NPM Build Status

Elliptic curve cryptography functions (ECC)

Private Key, Public Key, Signature, AES, Encryption / Decryption

Import

import ecc from 'ala-ecc1'
// or
const ecc = require('ala-ecc1')

Common API

wif

Wallet Import Format

Type: string

ecc

randomKey

Parameters

  • cpuEntropyBits number gather additional entropy from a CPU mining algorithm. Set to 0 for testing. (optional, default 128)

Examples

ecc.randomKey()

Returns wif

seedPrivate

Parameters

  • seed string any length string. This is private. The same seed produces the same private key every time. At least 128 random bits should be used to produce a good private key.

Examples

ecc.seedPrivate('secret') === wif

Returns wif

privateToPublic

Parameters

Examples

ecc.privateToPublic(wif) === pubkey

Returns pubkey

isValidPublic

Parameters

Examples

ecc.isValidPublic(pubkey) === true

Returns boolean valid

isValidPrivate

Parameters

Examples

ecc.isValidPrivate(wif) === true

Returns boolean valid

sign

Create a signature using data or a hash.

Parameters

  • data (string | Buffer)
  • privateKey (wif | PrivateKey)
  • hashData boolean sha256 hash data before signing (optional, default true)

Examples

ecc.sign('I am alive', wif)

Returns string hex signature

verify

Verify signed data.

Parameters

Examples

ecc.verify(signature, 'I am alive', pubkey) === true

Returns boolean

recover

Recover the public key used to create the signature.

Parameters

Examples

ecc.recover(signature, 'I am alive') === pubkey

Returns pubkey

sha256

Parameters

  • data (string | Buffer)
  • encoding string 'hex', 'binary' or 'base64' (optional, default 'hex')

Examples

ecc.sha256('hashme') === '02208b..'

Returns (string | Buffer) Buffer when encoding is null, or string

pubkey

ALAKey..

Type: string

Usage (Object API)

let {PrivateKey, PublicKey, Signature, Aes, key_utils, config} = require('ala-ecc1')

// Create a new random private key
privateWif = PrivateKey.randomKey().toWif()


// Convert to a public key
pubkey = PrivateKey.fromWif(privateWif).toPublic().toString()

Browser

git clone https://github.com/ALADIN-Network/ala-ecc1.git
cd ala-ecc1
npm install
npm run build
# builds: ./dist/ala-ecc1.js
# Verify release hash
<script src=ala-ecc1.js></script>
var ecc = alaexplorerjs_ecc
var privateWif = ecc.randomKey()
var pubkey = ecc.privateToPublic(privateWif)
console.log(pubkey)

Configure

const {config} = require('ala-ecc1')

// Change the public key address prefix
// config.address_prefix = 'XXX'

See Config