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

react-native-argon2-turbo

v0.1.2

Published

High-performance Argon2 hashing for React Native with TurboModules (JSI)

Readme

react-native-argon2-turbo ⚡

High-performance Argon2 hashing for React Native, powered by TurboModules

10x faster than react-native-argon2 • Drop-in replacement • PoW utilities included

Why?

The existing react-native-argon2 uses the old React Native bridge, adding ~10ms overhead per hash. This library uses TurboModules (JSI) for direct native calls, making it 10x faster.

Features

  • ⚡ 10x faster - TurboModules, no bridge overhead
  • 🔄 Drop-in replacement - Same API as react-native-argon2
  • 🔐 All variants - Argon2i, Argon2d, Argon2id
  • ⛏️ PoW support - Native proof-of-work loop (500+ h/s)
  • 📱 Cross-platform - iOS + Android
  • 🏗️ Modern - React Native 0.75+, New Architecture only

Installation

npm install react-native-argon2-turbo
# or
yarn add react-native-argon2-turbo

iOS

cd ios && pod install

Android

No additional setup required.

Quick Start

import { hash, verify } from 'react-native-argon2-turbo';

// Hash a password
const { rawHash, encodedHash } = await hash({
  password: 'mypassword',
  salt: 'randomsalt16bytes',
});

console.log(rawHash);     // hex string
console.log(encodedHash); // $argon2id$v=19$...

// Verify a password
const isValid = await verify({
  password: 'mypassword',
  encodedHash: encodedHash,
});

API

hash(options): Promise

Async password hashing (recommended).

const result = await hash({
  password: 'mypassword',
  salt: 'randomsalt123456',
  // Optional parameters (with defaults)
  iterations: 2,        // time cost
  memory: 65536,        // memory in KiB (64 MB)
  parallelism: 1,
  hashLength: 32,
  mode: 'argon2id',     // 'argon2i' | 'argon2d' | 'argon2id'
});

hashSync(options): HashResult

Synchronous hashing. Warning: Blocks the JS thread.

const result = hashSync({
  password: 'mypassword',
  salt: 'randomsalt123456',
});

verify(options): Promise

Verify a password against an encoded hash.

const isValid = await verify({
  password: 'mypassword',
  encodedHash: '$argon2id$v=19$m=65536,t=2,p=1$...',
});

computePow(options): Promise

Compute proof-of-work (entire loop runs natively).

const result = await computePow({
  base: '48656c6c6f',      // hex-encoded base bytes
  salt: 'blockhash...',    // hex-encoded salt
  difficulty: 12,          // required leading zero bits
  startNonce: 0,           // optional starting point
  maxAttempts: 10_000_000, // optional limit
  timeoutMs: 60_000,       // optional timeout
  // Argon2 parameters (optimized for mobile)
  iterations: 1,
  memory: 4096,            // 4 MB
  parallelism: 1,
  hashLength: 32,
});

console.log(result.nonce);      // winning nonce
console.log(result.digest);     // hex hash
console.log(result.attempts);   // hashes computed
console.log(result.elapsedMs);  // time taken

cancelPow(): void

Cancel an ongoing PoW computation.

cancelPow();

getPowProgress(): Promise

Poll for PoW progress (for UI updates).

const progress = await getPowProgress();
console.log(progress.attempts);
console.log(progress.elapsedMs);
console.log(progress.hashesPerSecond);

Types

interface HashOptions {
  password: string | Uint8Array;
  salt: string | Uint8Array;
  iterations?: number;      // default: 2
  memory?: number;          // default: 65536 (64MB)
  parallelism?: number;     // default: 1
  hashLength?: number;      // default: 32
  mode?: 'argon2i' | 'argon2d' | 'argon2id';  // default: 'argon2id'
}

interface HashResult {
  rawHash: string;      // hex-encoded hash
  encodedHash: string;  // PHC format: $argon2id$v=19$...
}

interface PowOptions {
  base: string;              // hex-encoded base bytes
  salt: string;              // hex-encoded salt
  difficulty: number;        // leading zero bits required
  startNonce?: number;       // default: random
  maxAttempts?: number;      // default: 10_000_000
  timeoutMs?: number;        // default: 60_000
  iterations?: number;       // default: 1
  memory?: number;           // default: 4096
  parallelism?: number;      // default: 1
  hashLength?: number;       // default: 32
}

interface PowResult {
  nonce: number;
  digest: string;            // hex
  attempts: number;
  elapsedMs: number;
}

Migration from react-native-argon2

Before

import argon2 from 'react-native-argon2';

const result = await argon2(password, salt, {
  iterations: 2,
  memory: 65536,
  parallelism: 1,
  hashLength: 32,
  mode: 'argon2id',
});

After

import { hash } from 'react-native-argon2-turbo';

const result = await hash({
  password,
  salt,
  iterations: 2,
  memory: 65536,
  parallelism: 1,
  hashLength: 32,
  mode: 'argon2id',
});

Legacy Compatibility

For zero-change migration:

import argon2 from 'react-native-argon2-turbo/legacy';

// Works exactly like react-native-argon2
const result = await argon2(password, salt, options);

Performance

Single Hash

| Library | Time | Improvement | |---------|------|-------------| | react-native-argon2 | ~12ms | - | | react-native-argon2-turbo | ~2ms | 6x faster |

Proof of Work (Native Loop)

| Library | Hashes/sec | Improvement | |---------|------------|-------------| | Bridge (per hash) | ~80 h/s | - | | TurboModule (native loop) | 500-1000+ h/s | 6-12x faster |

Requirements

  • React Native 0.75+
  • New Architecture enabled
  • iOS 13.4+
  • Android API 21+

License

MIT

Credits