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

@tykle/cghd

v1.0.1

Published

Cyclic Group Hashing Distribution - CGHD (256 bits)

Downloads

3

Readme

Cyclic Group Hashing Distribution CGHD-256

Support for TypeScript / Javascript

npm install @tykle/cghd --save

Context

Let assume a blockchain B and a group constant G (room). We want to gather within this group G people selected S according to a deterministic rule in a group of MAX(S) people. We also want the next topology of the group to be unpredictable.

Consider a group of 100 machines that must select 5 machines that will be in charge of monitoring the other 95. The machines share a piece of information, the last block of the blockchain. We create a time lag in order to verify that the assignments work

Examples

Example using Javascript:

const cghd = require("@tykle/cghd").default;

const blockchain = Buffer.from("0x7b298fb321a42d4eca960d17aa2461545ffebfa3480c697374096e56cbfad090")

// a set of machines
const machines = 100;

console.log("Create a room0 with 5 nodes", cghd("room0", 5, machines, blockchain))
console.log("Room name affects the result", cghd("room1", 5, machines, blockchain))
console.log("Number of required node affects the result", cghd("room0", 4, machines, blockchain))
console.log("Number of set affects the result", cghd("room0", 4, machines-1, blockchain))
console.log("Complexity increase the computation time and affects the result", cghd("room0", 5, machines, blockchain, 100000))

const stats = {collisions: 0}
const ret0 = cghd("room0", 75, machines, blockchain, 10, stats);
console.log(`Too much selected node creates collisions=${stats.collisions}`, ret0)

Should return

Create a room0 with 5 nodes [ 40n, 93n, 58n, 15n, 3n ]
Room name affects the result [ 79n, 49n, 31n, 1n, 25n ]
Number of required node affects the result [ 8n, 57n, 53n, 2n ]
Number of set affects the result [ 64n, 94n, 60n, 44n ]
Complexity increase the computation time and affects the result [ 45n, 84n, 10n, 3n, 77n ]
Too much selected node creates collisions=39 [
  76n, 10n, 21n, 35n, 64n, 95n, 52n, 45n, 32n, 58n, 89n,
  12n, 54n, 72n,  7n, 23n, 44n, 78n, 17n, 94n, 75n, 30n,
  85n, 63n, 31n, 38n, 61n, 39n, 40n, 69n,  5n, 80n,  4n,
  15n, 18n, 86n, 27n,  9n, 33n, 36n, 77n, 56n, 96n, 41n,
  73n,  2n, 48n,  3n, 91n, 11n, 53n, 65n,  8n, 46n, 13n,
   0n, 70n, 14n, 55n, 60n, 88n,  6n, 99n, 29n, 34n, 90n,
  71n, 51n, 57n, 68n, 67n, 16n, 84n, 20n, 79n
]