Introduction

Welcome to the cryptographer.js documentation. This guide covers everything you need to know to install, use, and contribute to the project.

πŸš€ Quick Start

Get started with cryptographer.js in minutes:

npm install cryptographer.js
import crypto from 'cryptographer.js';

// SHA-256 hash
const hash = crypto.sha.sha256('Hello World');
console.log(hash); // 'a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e'

// AES-256-CBC encryption
const encrypted = crypto.cipher.aes.encrypt('Hello World', {
  key: Buffer.from('0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef', 'hex'),
  iv: Buffer.from('0123456789abcdef0123456789abcdef', 'hex')
});

// ChaCha20 stream
const key = require('crypto').randomBytes(32);
const nonce = require('crypto').randomBytes(12);
const chachaEnc = crypto.cipher.chacha20.encrypt('Hi', { key, iv: nonce, mode: 'ctr' });

// DES (legacy)
const desKey = require('crypto').randomBytes(8);
const desIv = require('crypto').randomBytes(8);
const desEnc = crypto.cipher.des.encrypt('legacy', { key: desKey, iv: desIv, mode: 'cbc' });

// Argon2id password hash
const passwordHash = crypto.kdf.argon2('p@ssw0rd');

// Ed25519 signature
const { ed25519 } = crypto;
const ed = ed25519.generateKeypair(); // 32B secret/public
const sig = ed25519.sign(ed.privateKey, 'hello'); // 64B signature
console.log('ed25519 ok?', ed25519.verify(ed.publicKey, 'hello', sig)); // boolean

πŸ“š What's Inside

  • Getting Started - Installation and basic setup

  • API Reference - Complete function documentation (Hash, HMAC, Cipher, DSA, KDF, ZK)

  • Examples - Real-world usage examples

  • Security Guide - Best practices and security considerations

  • Performance - Benchmarks and optimization tips

  • Contributing - How to contribute to the project

🎯 Key Features

  • High Performance - Built with Rust and WebAssembly

  • Comprehensive - Hash functions, ciphers, HMAC, and KDF

  • Type Safe - Full TypeScript support

  • Node.js Optimized - Designed for server-side applications

  • Well Tested - Extensive test coverage

  • Production Ready - Industry-standard implementations

Use the sidebar to navigate between sections. Each section provides detailed information and examples.

Last updated