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

cryptorify

v1.0.5

Published

A lightweight, flexible encryption library for Node.js, providing secure AES-based encryption with GCM mode by default. Customize algorithms, encoding, and other parameters to suit your needs. Perfect for securing sensitive data with simplicity and speed.

Downloads

5

Readme

Cryptorify - Secure Encryption and Decryption Utility

Cryptorify is a lightweight utility for securely encrypting and decrypting data using the AES-GCM algorithm. It ensures data integrity and confidentiality with robust encryption techniques.


Features

  • Uses AES-256-GCM for encryption, a secure and widely trusted algorithm.
  • Supports customizable encryption options such as encoding type, salt length, and PBKDF2 iterations.
  • Ensures integrity with GCM's authentication tag.
  • Easy-to-use API for encryption and decryption.

Installation

npm i cryptorify

Usage

Importing the Cryptorify Class

const Cryptorify = require('cryptorify');

Encrypting Data

const cryptorify = new Cryptorify('mySecretKey');

const encrypted = cryptorify.encrypt('Hello, World!');
console.log('Encrypted:', encrypted);

Decrypting Data

const decrypted = cryptorify.decrypt(encrypted);
console.log('Decrypted:', decrypted);

Constructor

The Cryptorify constructor initializes the class with a secret and optional configuration.

const cryptorify = new Cryptorify(secret, options);

Parameters:

  • secret (string, required): A non-empty string used as the encryption key.
  • options (object, optional):
    • algorithm (string): The encryption algorithm. Default: aes-256-gcm.
    • encoding (string): The encoding for encrypted output. Default: hex.
    • saltLength (number): The length of the salt (in bytes). Default: 64.
    • pbkdf2Iterations (number): The number of iterations for PBKDF2 key derivation. Default: 100,000.

Methods

encrypt(value)

Encrypts the given value.

  • Parameters:

    • value (string | number | Buffer, required): The value to encrypt.
  • Returns:

    • string: The encrypted data encoded in the specified encoding format.
  • Example:

    const encrypted = cryptorify.encrypt('Sensitive Data');
    console.log('Encrypted:', encrypted);

decrypt(value)

Decrypts the given encrypted value.

  • Parameters:

    • value (string, required): The encrypted data to decrypt.
  • Returns:

    • string: The original value after decryption.
  • Example:

    const decrypted = cryptorify.decrypt(encrypted);
    console.log('Decrypted:', decrypted);

Example Code

const Cryptorify = require('Cryptorify');

// Initialize Cryptorify with a secret key
const cryptorify = new Cryptorify('mySuperSecretKey', {
    algorithm: 'aes-256-gcm',
    encoding: 'hex',
    saltLength: 64,
    pbkdf2Iterations: 100000
});

// Encrypt a message
const encrypted = cryptorify.encrypt('Hello, Encryption!');
console.log('Encrypted:', encrypted);

// Decrypt the message
const decrypted = cryptorify.decrypt(encrypted);
console.log('Decrypted:', decrypted);

Error Handling

Encryption Errors

  • Throws an error if the value to encrypt is null or undefined.

Decryption Errors

  • Throws an error if the value to decrypt is null, undefined, or invalid.

Initialization Errors

  • Throws an error if the secret is not a non-empty string.
  • Throws an error if the algorithm is not supported or doesn't include GCM.

Security Considerations

  • Key Management: Use a strong, unique secret key for each application.
  • Algorithm: This utility supports only AES algorithms in GCM mode for added integrity checks.
  • PBKDF2: The number of iterations (default: 100,000) can be increased for additional security.

License

Cryptorify is released under the MIT License.