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

cypher-ts

v0.1.2

Published

Librería de criptografía de alto rendimiento en TypeScript puro (AES, ChaCha20, Salsa20, GCM, Poly1305)

Readme

Cypher-TS

Biblioteca de criptografía de alto rendimiento en TypeScript puro, enfocada en algoritmos modernos (AEAD) y modos clásicos. Diseñada para entornos de Navegador y Servidor (Bun/Node) con cero dependencias y un enfoque en la velocidad.

Características

  • Modos AES:
    • GCM (Galois/Counter Mode) - AEAD de alto rendimiento.
    • CBC (Cipher Block Chaining).
    • CTR (Counter Mode).
    • CMAC (Cipher-based Message Authentication Code).
    • FF1 (Format-Preserving Encryption).
  • Cifradores de Flujo (ARX):
    • ChaCha20 y XChaCha20 (RFC 8439).
    • Salsa20 y XSalsa20.
  • MACs:
    • Poly1305.
  • Rendimiento: Primitivas ARX optimizadas y gestión de buffers sin copias innecesarias (zero-copy).
  • Entorno: Compatible con Bun, Node.js y navegadores modernos.

Instalación

npm install cypher-ts
# o
bun add cypher-ts

Uso

AES-GCM (Cifrado Autenticado)

import { GCM } from 'cypher-ts';

const key = new Uint8Array(32); // Clave de 256 bits
const nonce = new Uint8Array(12); // Nonce de 96 bits
const data = new TextEncoder().encode("Mensaje secreto");

const cipher = new GCM(key, nonce);
const encrypted = cipher.encrypt(data); // Retorna [ciphertext + tag de 16 bytes]
const decrypted = cipher.decrypt(encrypted);

ChaCha20-Poly1305

import { ChaCha20Poly1305 } from 'cypher-ts';

const aead = new ChaCha20Poly1305(key, nonce);
const ciphertext = aead.encrypt(data);
const plaintext = aead.decrypt(ciphertext);

Cifrado Preservador de Formato (FF1)

import { FF1 } from 'cypher-ts';

const ff1 = new FF1(10, key, tweak); // Radix 10 (dígitos)
const dígitos = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
const encrypted = ff1.encrypt(dígitos);

Benchmarks

Esta biblioteca ha sido diseñada para ser una de las implementaciones en JavaScript puro más rápidas existentes, superando o igualando a menudo a @noble/ciphers en algoritmos como ChaCha20 y GCM.

Para ejecutar los benchmarks:

bun run bench
# o ejecutar uno específico
bun tests/benchmarks/gcm.bench.ts

Seguridad

Esta es una implementación en TypeScript puro. Aunque utiliza operaciones de tiempo constante para ARX (ChaCha/Salsa), los motores de JavaScript pueden introducir canales laterales de tiempo a través de optimizaciones JIT. Para requisitos de alta seguridad en Node/Bun, considere el uso de bindings nativos si están disponibles.

Licencia

MIT