
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
react-native-argon2-turbo
Advanced tools
High-performance Argon2 hashing for React Native with TurboModules (JSI)
High-performance Argon2 hashing for React Native, powered by TurboModules
10x faster than react-native-argon2 • Drop-in replacement • PoW utilities included
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.
npm install react-native-argon2-turbo
# or
yarn add react-native-argon2-turbo
cd ios && pod install
No additional setup required.
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,
});
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'
});
Synchronous hashing. Warning: Blocks the JS thread.
const result = hashSync({
password: 'mypassword',
salt: 'randomsalt123456',
});
Verify a password against an encoded hash.
const isValid = await verify({
password: 'mypassword',
encodedHash: '$argon2id$v=19$m=65536,t=2,p=1$...',
});
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
Cancel an ongoing PoW computation.
cancelPow();
Poll for PoW progress (for UI updates).
const progress = await getPowProgress();
console.log(progress.attempts);
console.log(progress.elapsedMs);
console.log(progress.hashesPerSecond);
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;
}
import argon2 from 'react-native-argon2';
const result = await argon2(password, salt, {
iterations: 2,
memory: 65536,
parallelism: 1,
hashLength: 32,
mode: 'argon2id',
});
import { hash } from 'react-native-argon2-turbo';
const result = await hash({
password,
salt,
iterations: 2,
memory: 65536,
parallelism: 1,
hashLength: 32,
mode: 'argon2id',
});
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);
| Library | Time | Improvement |
|---|---|---|
| react-native-argon2 | ~12ms | - |
| react-native-argon2-turbo | ~2ms | 6x faster |
| Library | Hashes/sec | Improvement |
|---|---|---|
| Bridge (per hash) | ~80 h/s | - |
| TurboModule (native loop) | 500-1000+ h/s | 6-12x faster |
MIT
FAQs
High-performance Argon2 hashing for React Native with TurboModules (JSI)
We found that react-native-argon2-turbo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.