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

cuckoo-cycle

v0.3.0

Published

A javascript 32bit implementation of Cuckoo Cycle

Downloads

3

Readme

Cuckoo Cycle JS

This is a 32bit and 64bit javascript version of Cuckoo Cycle.

Do note that the 32bit version is not compatible with the 64bit version

This is due to the following:

  • 32bit integers
  • Uses 32bit version of SipHash-2-4

Getting Started

First install via npm

npm install cuckoo-cycle --save

Cuckoo 64bit JS Version

Thanks to the underlying js engines now using 64bit Doubles for all numbers and implementing Float64Array(); it is now possible to use the original uint 64bit version.

To access the 64bit version of the below API just add a 64 to the end of the name like so:

const {Cuckoo64} = require('cuckoo-cycle');
const {Miner64} = require('cuckoo-cycle');
const {Solver64} = require('cuckoo-cycle');

All the below API access still applies just the same, except the miner will now return a Float64Array for the solution.

Cuckoo Verifier API

To verify a Cuckoo Cycle you will need 3 things: The original hash, the solution array of the 42 nonces, and what difficulty level the solution was solved for.

To access the main CuckooCycle verifier

const {Cuckoo} = require('cuckoo-cycle');

To access the standard difficulty

Cuckoo.DIFFICULTY //which is 50 * Cuckoo.SIZE / 100

To make your own difficulty

const percent = 45;
const DIFF = percent * Cuckoo.SIZE / 100;

To verify something

const verifier = new Cuckoo(data);
const solution = [...]; //42 nonces
const isValid = verifier.verify(solution, DIFFICULTY);

Other API

verifier.update(data);

Cuckoo Miner API

To access the Miner and Solver.

const {Miner, Solver} = require('cuckoo-cycle');

Creating a solver and miner

const solver = new Solver(data, DIFFICULTY);

//index is the number of the miner instance
//total is the total number of miners running at once
const miner = new Miner(solver, [index optional], [total optional]);

const solution = miner.run();

if(solution) {
    //yay found a solution with 42 nonces for our hash
    //the solution will be either false or a UInt32Array with a length of 42
}

What if there is no solution? Well then you will need to rehash based upon a new nonce. As the cuckoo cycle could be considered micro nonces. The default difficulty has a rough 2.2% chance of finding a valid 42 nonce cycle.

For further information on Cuckoo Cycle see the link to the original github repo.

LICENSE

The FAIR MINING License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

FAIR MINING Any derived miner that charges a developer fee for mining a fair coin ---one with no premine or other form of developer compensation--- shall offer to share half the fee revenue with the coin developers.

The above copyright notice, FAIR MINING condition, and this permission notice shall be included in all copies or substantial portions of the Software.

ALTERNATIVELY, this software may be distributed under the terms of the GNU General Public License ("GPL") version 2 or later, as published by the Free Software Foundation.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.