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

random-universe-cipher

v1.0.1

Published

Random Universe Cipher - A quantum-resistant symmetric block cipher

Readme

Random Universe Cipher (RUC)

A quantum-resistant symmetric block cipher with 256-bit security. Protects data against both classical and quantum computing attacks.

Links

  • Live Tool: https://rosettascript.github.io/tools/random-universe-cipher
  • Blog Post: https://rosettascript.github.io/blogs/random-universe-cipher-ruc-post-quantum-security
  • GitHub: https://github.com/rosettascript/random-universe-cipher

Why RUC?

Traditional ciphers like AES and ChaCha20 may become vulnerable when quantum computers become mainstream. RUC is designed from the ground up to resist quantum attacks while maintaining exceptional security against classical cryptanalysis.

Installation

npm install random-universe-cipher

Quick Start

import { encrypt, decrypt, deriveKeyFromPassword } from 'random-universe-cipher';

// Derive key from password
const keyMaterial = await deriveKeyFromPassword('my-password', 'salt');

// Encrypt
const plaintext = new TextEncoder().encode('Hello, World!');
const encrypted = encrypt(plaintext, keyMaterial.key, keyMaterial.iv);

// Decrypt
const decrypted = decrypt(encrypted, keyMaterial.key, keyMaterial.iv);
console.log(new TextDecoder().decode(decrypted)); // "Hello, World!"

Security Specifications

| Parameter | Value | |-----------|-------| | Key Size | 512 bits (64 bytes) | | Block Size | 256 bits (32 bytes) | | Rounds | 24 (fixed) | | Security Level | 256-bit post-quantum | | Classical Security | 512 bits | | Quantum Security | 256 bits |

How It Works

Core Design Principles

Confusion - Complex, non-linear relationship between key and ciphertext:

  • Galois Field (GF) multiplication for algebraic complexity
  • 24 unique S-boxes generated from the master key
  • Dynamic selector-based register routing

Diffusion - Small input changes cause large output changes:

  • 7 state registers (512 bits each) = 3,584 bits internal state
  • 1,024-bit accumulator collects transformation results
  • SHAKE256 keystream ensures maximum diffusion

Security - Resistance against cryptanalytic attacks:

  • 24 rounds provide sufficient mixing
  • S-boxes with high non-linearity (≥ 100)
  • Large state resists various attack vectors

Architecture

Key (512-bit) ──┬──> SHAKE256 ──> State Registers R[0..6]
                ├──> SHAKE256 ──> Selectors SEL[0..N]
                ├──> SHAKE256 ──> Round Keys RK[0..23]
                └──> SHAKE256 ──> S-Boxes S[0..23]

IV + State ──> mix_iv_into_state() ──> Initialized State

For each block:
  State + Selectors + Round Keys + S-Boxes ──> 24 Rounds ──> Accumulator
  Accumulator + Final State ──> SHAKE256 ──> Keystream
  Plaintext XOR Keystream ──> Ciphertext

API

Key Derivation

// Async key derivation (recommended - uses Argon2id)
const keyMaterial = await deriveKeyFromPassword('password', 'salt');

// Sync key derivation (uses SHAKE256)
const keyMaterial = deriveKeySync('password', 'salt');

// Generate random salt
const salt = generateSalt();

// Generate random key/IV
const key = generateRandomKey();
const iv = generateRandomIV();

Encryption

// CTR mode (default)
const encrypted = encrypt(plaintext, key, iv);
const decrypted = decrypt(ciphertext, key, iv);

// CBC mode
const encrypted = encryptCBC(plaintext, key, iv);
const decrypted = decryptCBC(ciphertext, key, iv);

// Single block
const ciphertext = encryptBlock(plaintext, key, iv, 0n, state, keyMaterial);

AEAD (Authenticated Encryption)

// Encrypt with authentication
const result = await aeadEncrypt(plaintext, key, iv, 'additional-data');
const decrypted = await aeadDecrypt(result.ciphertext, key, result.tag, 'additional-data');

// String convenience
const encrypted = await aeadEncryptString('message', 'password');
const decrypted = await aeadDecryptString(encrypted, 'password');

Low-Level API

import { 
  expandKey, 
  mixIVIntoState, 
  generateSBox, 
  encryptBlock,
  createCipherState 
} from 'random-universe-cipher';

// Generate S-boxes
const sbox = generateSBox(key);

// Expand key
const keyMaterial = expandKey(key);

// Mix IV into state
const state = mixIVIntoState(keyMaterial.registers, iv);

// Encrypt single block
const ciphertext = encryptBlock(plaintext, key, iv, 0n, state, keyMaterial);

Requirements

  • Node.js 18+ or modern browser
  • @noble/hashes (installed as dependency)

Disclaimer

This is a demonstration implementation. The cipher has not been audited for production use. Use at your own risk.

License

MIT