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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@fulroi/crypto-utils

v1.0.0

Published

Crypto utilities and string helpers for Node.js applications

Readme

@fulroi/crypto-utils

🔒 Cryptographic utilities and string helpers for Node.js applications

📦 Installation

npm install @fulroi/crypto-utils

🚀 Quick Start

import { PasswordHash, SecureEncrypt, capitalize, normalize } from '@fulroi/crypto-utils';

// Hash passwords securely
const hash = await PasswordHash.hash('userPassword123');
const isValid = await PasswordHash.verify('userPassword123', hash);

// Encrypt/decrypt data
const encrypted = await SecureEncrypt.encrypt('sensitive data', 'secretKey');
const decrypted = await SecureEncrypt.decrypt(encrypted, 'secretKey');

// String utilities
const title = capitalize('hello world'); // "Hello World"
const slug = normalize('Título con Ácentos'); // "titulo-con-acentos"

📚 API Reference

Password Security

PasswordHash.hash(password: string): Promise<string>

Securely hash a password using bcrypt with automatic salt generation.

PasswordHash.verify(password: string, hash: string): Promise<boolean>

Verify a password against its hash.

PasswordHash.needsRehash(hash: string): boolean

Check if a hash needs updating to stronger security parameters.

Data Encryption

SecureEncrypt.encrypt(text: string, secret: string): Promise<string>

Encrypt data using AES-256-GCM with random IV and salt for each operation.

SecureEncrypt.decrypt(encryptedData: string, secret: string): Promise<string>

Decrypt data that was encrypted with SecureEncrypt.encrypt().

String Utilities

capitalize(str: string): string

Capitalizes the first letter of each word in a string.

capitalize('hello world') // "Hello World"

normalize(str: string): string

Normalizes a string by removing accents, replacing special characters with hyphens, and converting to lowercase.

normalize('Título con Ácentos!') // "titulo-con-acentos"

🔐 Security Features

  • bcrypt password hashing with configurable cost factor (12)
  • AES-256-GCM encryption with authenticated encryption
  • Random IV and salt for each encryption operation
  • Input validation and error handling
  • TypeScript support with full type definitions

📄 Examples

Password Management

import { PasswordHash } from '@fulroi/crypto-utils';

// Registration
const userPassword = 'userInput123';
const hashedPassword = await PasswordHash.hash(userPassword);
// Store hashedPassword in database

// Login
const loginPassword = 'userInput123';
const isValidPassword = await PasswordHash.verify(loginPassword, hashedPassword);
if (isValidPassword) {
    // User authenticated
}

Data Encryption

import { SecureEncrypt } from '@fulroi/crypto-utils';

const sensitiveData = 'Credit card: 4111-1111-1111-1111';
const secretKey = process.env.ENCRYPTION_KEY;

// Encrypt
const encrypted = await SecureEncrypt.encrypt(sensitiveData, secretKey);
// Store encrypted data

// Decrypt
const decrypted = await SecureEncrypt.decrypt(encrypted, secretKey);
console.log(decrypted); // 'Credit card: 4111-1111-1111-1111'

String Processing

import { capitalize, normalize } from '@fulroi/crypto-utils';

// Title formatting
const title = capitalize('product management system'); // "Product Management System"

// URL-friendly slugs
const slug = normalize('Café & Restaurante São Paulo'); // "cafe-restaurante-sao-paulo"

⚙️ Requirements

  • Node.js 14 or higher
  • TypeScript 4.0+ (for TypeScript projects)

📝 License

MIT

🤝 Contributing

Contributions, issues and feature requests are welcome!