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-audit-tool

v1.0.0

Published

A professional crypto audit and validation toolkit for blockchain addresses, signatures, and cryptographic operations

Readme

crypto-audit-tool

npm version Node.js CI License: MIT

A comprehensive Node.js toolkit for cryptocurrency address validation, signature verification, and cryptographic operations. Designed for security auditing, blockchain application development, and compliance checks.

Features

  • Ethereum Address Validation - Support for both lowercase and EIP-55 checksum addresses
  • Bitcoin Address Validation - Legacy (P2PKH/P2SH) and SegWit (Bech32) support
  • Signature Verification - ECDSA signature verification with flexible key formats
  • Hash Utilities - SHA-256, Keccak-256 and other hash functions
  • Key Pair Generation - Secp256k1, P-256, and prime256v1 curves
  • Public Key Recovery - Recover public key from signature and message hash
  • Zero Dependencies for Core Functions - Minimal required dependencies
  • TypeScript Support - Includes TypeScript definitions

Installation

npm install crypto-audit-tool

Usage

Validate Ethereum Addresses

const { validateEthereumAddress, toChecksumAddress } = require('crypto-audit-tool');

// Basic validation
validateEthereumAddress('0x742d35Cc6634C0532925a3b844Bc9e7595f32145'); // true
validateEthereumAddress('0x742d35cc6634c0532925a3b844bc9e7595f32145'); // true
validateEthereumAddress('742d35Cc6634C0532925a3b844Bc9e7595f32145');   // true
validateEthereumAddress('invalid'); // false

// Convert to checksum
toChecksumAddress('0x742d35cc6634c0532925a3b844bc9e7595f32145');
// '0x742d35Cc6634C0532925a3b844Bc9e7595f32145'

Validate Bitcoin Addresses

const { validateBitcoinAddress } = require('crypto-audit-tool');

// Legacy addresses
validateBitcoinAddress('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa'); // true
validateBitcoinAddress('3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy'); // true

// Bech32 (SegWit) addresses
validateBitcoinAddress('bc1qw4vdy9j7z8e95d5g3qh6yjedz9g0k2g0k5p6xl'); // true
validateBitcoinAddress('bc1q8372q7peydt5jlh9wydkjmdl6gf5nyj8cxq0ew'); // true

validateBitcoinAddress('invalid'); // false

Verify Signatures

const { verifySignature, generateKeyPair, hashMessage } = require('crypto-audit-tool');

// Generate a key pair
const { privateKey, publicKey } = generateKeyPair('secp256k1');

// Sign a message (using private key manually)
const message = 'Important transaction data';
const messageHash = hashMessage(message, 'sha256');

// For demonstration, we'll sign using crypto module
const signature = crypto.sign(null, Buffer.from(message), { key: privateKey, format: 'der' });

// Verify the signature
const isValid = verifySignature(message, signature, publicKey, 'secp256k1');
console.log('Signature valid:', isValid);

Hash Messages

const { hashMessage } = require('crypto-audit-tool');

const hash = hashMessage('Hello, world!', 'sha256');
console.log(hash); // '315f5bdb76d078c43b8ac0064e4a0164615b2e8d9d12e4e3d2d8a6b16c4e32e5'

const keccak = hashMessage('Hello, world!', 'keccak256');
console.log(keccak);

Generate Key Pairs

const { generateKeyPair } = require('crypto-audit-tool');

// Secp256k1 (Ethereum, Bitcoin)
const ethKeys = generateKeyPair('secp256k1');

// P-256 (NIST)
const p256Keys = generateKeyPair('p256');

API Reference

validateEthereumAddress(address)

Validates an Ethereum address. Supports both mixed-case (EIP-55 checksum) and all-lowercase addresses.

  • address (string): Ethereum address, with or without '0x' prefix
  • Returns: boolean

toChecksumAddress(address)

Converts an Ethereum address to EIP-55 checksum format.

  • address (string): Ethereum address
  • Returns: string (checksum address with 0x prefix)

validateBitcoinAddress(address)

Validates a Bitcoin address. Supports legacy (Base58) and Bech32 formats.

  • address (string): Bitcoin address
  • Returns: boolean

verifySignature(message, signature, publicKey, [curve])

Verifies an ECDSA signature.

  • message (string|Buffer): Original message
  • signature (string|Buffer): DER-encoded signature or hex string
  • publicKey (string|Buffer): Public key (hex, DER, or PEM)
  • curve (string): Curve name ('secp256k1', 'p256', 'prime256v1')
  • Returns: boolean

hashMessage(message, [algorithm])

Hashes a message using specified algorithm.

  • message (string|Buffer): Input message
  • algorithm (string): Hash algorithm (default: 'sha256')
  • Returns: string (hex digest)

generateKeyPair([curve])

Generates a new elliptic curve key pair.

  • curve (string): Curve name (default: 'secp256k1')
  • Returns: { privateKey: string, publicKey: string }

recoverPublicKey(messageHash, signature, recoveryId)

Recovers public key from signature and message hash (secp256k1 only).

  • messageHash (Buffer): 32-byte hash of the message
  • signature (Buffer): DER-encoded signature
  • recoveryId (number): Recovery ID (0-3)
  • Returns: Buffer|null

Security

This library is intended for cryptographic validation and auditing purposes. While it uses well-established algorithms and libraries, always perform your own security review before using in production environments.

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

License

MIT © 2024 Security Developer