React Native Quick Crypto
Introduction

Comparison

RNQC vs The Rest

RNQC is designed to be the faster, more complete alternative to existing solutions.

FeatureRNQCreact-native-cryptoreact-native-fast-crypto
PerformanceNitro (Native C++)🐢 Bridge (JS-shim)⚡️ JSI (Partial)
Node.js API1:1 CompatibleCompatibleCustom API
Sync MethodsFully SupportedAsync OnlySupported
Thread SafetyOff-Main-ThreadBlocks JS ThreadOff-Main-Thread
MaintenanceActive (Margelo)AbandonedStale

Visual Comparison

Standard Bridge vs. RNQC Nitro


Theory: Why is it faster?

The performance gap comes down to Memory Access and Execution Model.

1. Zero-Copy Buffers

Standard React Native modules (like react-native-crypto) communicate via the Bridge. To hash a 1MB file:

  1. JS: Converts Buffer to Base64 string (Costly).
  2. Bridge: Serializes msg to JSON. Used double memory.
  3. Native: Deserializes JSON, decodes Base64 to bytes.
  4. Native: Hashes bytes.

RNQC (Nitro):

  1. JS: Holds a reference to an ArrayBuffer.
  2. C++: Reads that memory address directly. Hash.
  3. Done.

2. C++ Thread Pool

JSI allows us to define "Hybrid Objects" that can spawn their own C++ threads. We use a dedicated thread pool for heavy algorithms (like scrypt or rsa keygen), ensuring the main JS thread (and your UI) is never blocked, while avoiding the overhead of spawning new OS threads for every call.


Benchmarks

Proof is in the numbers. We benchmarked RNQC against standard JS implementations (browserify) and other native libraries.

Benchmark Philosophy: This is not meant to disparage the other libraries. On the contrary, they perform amazingly well when used in a server-side Node environment or browser. This library exists because React Native does not have that environment nor the Node Crypto API implementation at hand. So the benchmark suite is there to show you the speedup vs. the alternative of using a pure JS library on React Native.

Environment: iPhone 15 Pro, iOS 17.

1. Hashing (BLAKE3)

Blake3 Benchmark

BLAKE3 is optimized for speed. RNQC (via Nitro) processes large inputs 90x faster than JS implementations.

OperationRNQC@noble/hashesSpeedup
32b input105,397 ops/s13,175 ops/s8x 🚀
64KB input1,307 ops/s14 ops/s93x 🚀
Streaming39,208 ops/s938 ops/s41x 🚀

2. Encryption (AES-GCM / Salsa20)

Cipher Benchmark

Native encryption prevents frame drops. AES-256-GCM is over 100x faster for large buffers.

OperationRNQCJS / BrowserifySpeedup
XSalsa20 (64KB)852 ops/s7.39 ops/s115x 🚀
AES-256-GCM (1MB)177 ops/s0.18 ops/s (browserify)962x 🚀
AES-256-GCM (1MB)177 ops/s1.32 ops/s (@noble)134x 🚀

3. Key Derivation (PBKDF2)

PBKDF2 Benchmark

Password hashing is computationally expensive. Running this on the JS thread freezes the UI.

OperationRNQC@noble/hashesSpeedup
PBKDF2 (async)52,948 ops/s1,447 ops/s36x 🚀
PBKDF2 (sync)76,601 ops/s1,459 ops/s52x 🚀

4. Signatures (Ed25519)

Ed25519 Benchmark

Essential for crypto wallets. Verify signatures instantly without lag.

OperationRNQC@noble/curvesSpeedup
Sign/Verify (async)9,917 ops/s60 ops/s164x 🚀
Sign/Verify (sync)17,108 ops/s60 ops/s285x 🚀

5. HKDF

HKDF Benchmark

Standard key derivation is over 100x faster.

OperationRNQC@noble/hashesSpeedup
HKDF (async)65,792 ops/s582 ops/s112x 🚀
HKDF (sync)70,918 ops/s572 ops/s123x 🚀

6. Scrypt (Memory Hard)

Scrypt is a memory-hard key derivation function, making it incredibly slow in pure JavaScript. Native implementation provides massive gains.

OperationRNQC@noble/hashesSpeedup
scrypt (async)1,791 ops/s2.98 ops/s601x 🚀
scrypt (sync)2,160 ops/s3.10 ops/s696x 🚀

On this page