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

dht-id

v1.0.2

Published

DHT circular IDs generator and methods

Downloads

6

Readme

dht-id

dht-id generator and operator, designed with circular Id namespaces in mind, used in webrtc-explorer. Currently only supports 48 bits, but I'm happy to make accept PR that make it Id size agnostic.

Project Information

David Dias MSc in Peer-to-Peer Networks by Technical University of Lisbon

This work was developed by David Dias with supervision by Luís Veiga, all in INESC-ID Lisboa (Distributed Systems Group), Instituto Superior Técnico, Universidade de Lisboa, with the support of Fundação para a Ciência e Tecnologia.

More info on the team's work at:

  • http://daviddias.me
  • http://www.gsd.inesc-id.pt/~lveiga

If you use this project, please acknowledge it in your work by referencing the following document:

David Dias and Luís Veiga. browserCloud.js A federated community cloud served by a P2P overlay network on top of the web platform. INESC-ID Tec. Rep. 14/2015, Apr. 2015

Badgers

NPM

![Gitter](https://badges.gitter.im/Join Chat.svg)Dependency StatusBuild Status

Properties

  • Uses sha1 to guarantee that ID's are generated with an uniform distribution
  • Runs in Node.js and in the browser
  • Respects the natural circular ID namespace DHT are known to use (meaning that there is no ID higher than 48 bits)

How to use

var Id = require('dht-id);

var idA = new Id(); // generates a new random Id with 48 bits length

var idB = new Id(<value to generate the Id from>); // generates an Id based on the value, same value always generates same Id

idA.toHex(); // returns the hex value of the Id in a string

idA.toDec(); // returns the dec value of the Id in a number

idA.next(); // basically this id + 1, useful to send to Sucessor

Id.spin(); // returns an id larger than the max possible in Hex, useful when the message has to spin the ring

Id.hash(content); // convinient way to find the Id of a content and guarantee that it has our ideal id length