You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -57,7 +57,7 @@ Standard React Native modules (like `react-native-crypto`) communicate via the B
57
57
3.**Native**: Deserializes JSON, decodes Base64 to bytes.
58
58
4.**Native**: Hashes bytes.
59
59
60
-
**RNQC (JSI)**:
60
+
**RNQC (Nitro)**:
61
61
1.**JS**: Holds a reference to an `ArrayBuffer`.
62
62
2.**C++**: Reads that memory address directly. **Hash.**
63
63
3.**Done.**
@@ -72,14 +72,16 @@ JSI allows us to define "Hybrid Objects" that can spawn their own C++ threads. W
72
72
Proof is in the numbers. We benchmarked RNQC against standard JS implementations (`browserify`) and other native libraries.
73
73
74
74
<Callouttype="info">
75
-
**Benchmark Philosophy**: These comparisons are not meant to disparage pure JavaScript libraries. Libraries like `@noble/hashes` and `@noble/curves`perform exceptionally well in browser and Node.js environments. However, React Native lacks Node.js crypto APIs, so these benchmarks demonstrate the performance advantage of native implementations when pure JS is the only alternative on mobile.
75
+
**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.
76
76
</Callout>
77
77
78
78
**Environment**: iPhone 15 Pro, iOS 17.
79
79
80
80
## 1. Hashing (BLAKE3)
81
81
82
-
BLAKE3 is optimized for speed. RNQC (via JSI) processes large inputs **90x faster** than JS implementations.
82
+

83
+
84
+
BLAKE3 is optimized for speed. RNQC (via Nitro) processes large inputs **90x faster** than JS implementations.
83
85
84
86
| Operation | RNQC |@noble/hashes| Speedup |
85
87
| :--- | :--- | :--- | :--- |
@@ -89,15 +91,20 @@ BLAKE3 is optimized for speed. RNQC (via JSI) processes large inputs **90x faste
89
91
90
92
## 2. Encryption (AES-GCM / Salsa20)
91
93
94
+

95
+
92
96
Native encryption prevents frame drops. `AES-256-GCM` is over **100x faster** for large buffers.
Copy file name to clipboardExpand all lines: docs/content/docs/introduction/complete-setup.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -203,12 +203,12 @@ yarn start --reset-cache
203
203
If you need to use the `xsalsa20` cipher algorithm, you must enable libsodium support by setting an environment variable **before building your native code**:
204
204
205
205
```bash
206
-
exportRN_QUICK_CRYPTO_LIBSODIUM=1
206
+
exportSODIUM_ENABLED=1
207
207
```
208
208
209
209
This can be done:
210
-
-**iOS**: Set in your Xcode build settings or in a pre-build script
211
-
-**Android**: Add to your `gradle.properties`or as a build environment variable
210
+
-**iOS**: Export the variable `export SODIUM_ENABLED=1` before running `pod install`.
211
+
-**Android**: Add `sodiumEnabled=true`to your project's `gradle.properties`file.
212
212
213
213
<Callouttype="warn">
214
214
Without this flag, attempting to use `xsalsa20` will throw a runtime error: `"libsodium must be enabled to use this cipher"`
0 commit comments