React Native Quick Crypto
Guides

Migration Guide

Moving from legacy libraries to RNQC

If you are coming from react-native-crypto (the slow, standard shim) or expo-crypto, here is how to upgrade.

Why Upgrade?

  • Performance: Hundreds of times faster (via C++/JSI).
  • Compatibility: Supports modern Node.js 16+ crypto APIs.
  • Correctness: Passes the official Node.js test suite.

Migrating from react-native-crypto

react-native-crypto (and rn-nodeify) relies on the React Native Bridge and pure JS fallbacks, which are extremely slow.

Uninstall Legacy Libs

Remove the old shims.

npm uninstall react-native-crypto rn-nodeify react-native-randombytes

Install RNQC

npm install react-native-quick-crypto react-native-nitro-modules
cd ios && pod install

Global Polyfill (Optional)

If your dependencies (like ethers.js or bitcoinjs-lib) expect crypto to be available globally:

index.js
// Top of your entry file
import { install } from 'react-native-quick-crypto';

install(); // Patches global.crypto and global.Buffer

Alternatively, you can just import crypto from the package directly if you don't want global side-effects:

import crypto from 'react-native-quick-crypto';

Migrating from expo-crypto

expo-crypto is a lightweight wrapper around system APIs. It is distinct from Node.js crypto.

FeatureExpo CryptoRNQC
API StyleCrypto.digestStringAsync()crypto.createHash().update().digest()
Streams❌ No✅ Yes
Ciphers❌ No (Just Hashing)✅ AES, ChaCha20, etc.
Sync Methods❌ Limited✅ Full Support

If you only need simple hashing (SHA-256), expo-crypto is fine. If you need encryption, decryption, or complex key derivation, you need RNQC.

Code Comparison

Expo Crypto (digest):

import * as Crypto from 'expo-crypto';

const digest = await Crypto.digestStringAsync(
  Crypto.CryptoDigestAlgorithm.SHA256,
  'Hello world'
);

RNQC (digest):

import { createHash } from 'react-native-quick-crypto';
const digest = createHash('sha256').update('Hello world').digest('hex');

On this page