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

@little-core-labs/hyperid-wasm

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@little-core-labs/hyperid-wasm

hyperid implementation written in ZZ compiled to WASM format

  • 0.1.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
3
Weekly downloads
 
Created
Source

hyperid-wasm

A HyperID implementation written in ZZ compiled to WebAssembly (WASM) format

Installation

Node

$ npm install @little-core-labs/hyperid-wasm

WAPM

$ wapm install jwerle/hyperid-wasm

Usage

const hyperid = require('hyperid-wasm')

hyperid.ready(() => {
  const hid = hyperid({ fixedLength: true, startFrom: 1024 })
  console.log(hid()) // atd1gpRDT1SJZnaOhdLR5Q/0000001024
  console.log(hid()) // atd1gpRDT1SJZnaOhdLR5Q/0000001025
})

API

generator = hyperid([opts])

Create a new hyperid generator where opts is the same arguments given to the original hyperid.

const generator = hyperid({
  fixedLength: false, // use a fixed length counter
  startFrom: 0, // initial counter value
  urlSafe: false, // use URL safe characters
})

id = generator()

Generate a hyperid from hyperid context. (See above)

const id = generator()

Benchmark

This original module is ~4x faster than this one.

hyperid generate - variable length (original) x 11,806,789 ops/sec ±1.59% (83 runs sampled)
hyperid generate - variable length (wasm) x 4,179,909 ops/sec ±0.95% (88 runs sampled)
hyperid generate - fixed length (original) x 9,347,663 ops/sec ±3.26% (88 runs sampled)
hyperid generate - fixed length (wasm) x 3,772,629 ops/sec ±2.14% (92 runs sampled)

Limits

Initial Memory

By default, this module allocates 2 pages of memory for the WebAssembly module. That is 2 * 64 * 1024 bytes.

Maximum Memory

This module allows at most 256 pages of memory. That is 256 * 64 * 1024 bytes.

See Also

License

MIT

Keywords

FAQs

Package last updated on 04 May 2020

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