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 🙏

© 2026 – Pkg Stats / Ryan Hefner

crypto-goat

v1.0.5

Published

Cryptography Javascript Library

Readme

CRYPTO-GOAT

Javascript Cryptography library

Build Status

crypto-goat is a simple, optimized, not super secure, npm cryptography module.

Features

  • Encryption and Decryption
  • Message Encoding
  • ✨Optimizations✨

Installation

crypto-goat requires Node.js to run.

Install the module and Dependencies to use the library.

cd your-directory
npm I crypto-goat

Development

How can I use this library??

Importing in the project:

const cryptoGoat = require('crypto-goat')

Keys generation:

let keys = generateKeyPair(p, q);

The function returns an array containing PublicKey and PrivateKey, both will be generated based on the same parameters P and Q, for P is recommended a small prime number, for the Q is recommended a big prime number with at least 6 digits (it won't work with less than 6 digits)

Encrypting a message:

let publicKey = keys[0];
let encrypted = publicKey.Encrypt('Hiii :)')

encrypted is going to be a Message object containing DF (Division Factors) array and a Message array

Decrypting a message:

let privateKey = keys[1];
let decrypted = privateKey.Decrypt(encrypted)

decrypted is going to be a Message object containing only a Message array

How it Works

crypto-goat is an RSA algorithm implementation. Since the algorithm uses an exponentiation operator at a certain point I had to optimize many things to get the module to work fast. First of all since after the exponentiation there was a modulo operator I converted the project to use bigInt library which contains a function called 'modPow' that optimizes the process. Since the algorithm needs integers I had to find a way to encode string messages to integer numbers, by doing that I inevitably stumble across the problem that with big string a big integer would get encoded and the algorithm would be slow, so I decided to do two things:

  • Divide the numbers by the biggest division factor available and store that factor in the message object sent across to be decrypted, for security reasons I decided to encrypt these values too.
  • Separate the text in multiple chunks of variable size and store them as an array with a single division factor for all of them. The message object is then going to be a collection of two smaller arrays: the message array containing the reduced version of the encrypted message and the division factors array that contains the factors to make the message array decryptable, this adds a little computation to add but a great comeback in performance.

The project is open source and if you have some optimizations to do feel free to propose changes to the directory.

License

MIT

WARNING: this library is done for educational purposes only and it's still in development, I don't recommend using it in serious projects