Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/post-maestro-screenshot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ runs:

### 📸 Final Test Screenshot

![Maestro Test Results - ${{ inputs.platform }}](${{ steps.upload-screenshot.outputs.url }})
<img src="${{ steps.upload-screenshot.outputs.url }}" alt="Maestro Test Results - ${{ inputs.platform }}" width="400" />

*Screenshot automatically captured from End-to-End tests and will expire in 30 days*

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "packages/react-native-quick-crypto/deps/blake3"]
path = packages/react-native-quick-crypto/deps/blake3
url = https://github.com/BLAKE3-team/BLAKE3.git
10 changes: 10 additions & 0 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
Expand Down Expand Up @@ -84,6 +84,16 @@
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
externalNativeBuild {
cmake {
arguments "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
}
}
}
packaging {
jniLibs {
pickFirsts += ["**/libNitroModules.so", "**/libc++_shared.so", "**/libfbjni.so"]
}
}
signingConfigs {
debug {
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
minSdkVersion = 24
compileSdkVersion = 36
targetSdkVersion = 36
ndkVersion = "27.1.12297006"
ndkVersion = "28.2.13676358"
kotlinVersion = "2.1.20"
}
repositories {
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2746,7 +2746,7 @@ SPEC CHECKSUMS:
hermes-engine: 4f8246b1f6d79f625e0d99472d1f3a71da4d28ca
NitroModules: 1715fe0e22defd9e2cdd48fb5e0dbfd01af54bec
OpenSSL-Universal: 6082b0bf950e5636fe0d78def171184e2b3899c2
QuickCrypto: 0e223a6fd5f3bf5841592a3aa9e0471078912ee8
QuickCrypto: 18cce2f53208e965986216aaa6d6bff0839618b0
RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669
RCTDeprecation: c4b9e2fd0ab200e3af72b013ed6113187c607077
RCTRequired: e97dd5dafc1db8094e63bc5031e0371f092ae92a
Expand Down
143 changes: 143 additions & 0 deletions example/src/benchmarks/blake3/blake3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import rnqc from 'react-native-quick-crypto';
import { blake3 as nobleBlake3 } from '@noble/hashes/blake3';
import type { BenchFn } from '../../types/benchmarks';
import { Bench } from 'tinybench';

const TIME_MS = 1000;

const blake3_32b: BenchFn = () => {
const data = rnqc.randomBytes(32);

const bench = new Bench({
name: 'blake3 32b input',
time: TIME_MS,
});

bench
.add('rnqc', () => {
rnqc.blake3(data);
})
.add('@noble/hashes/blake3', () => {
nobleBlake3(data);
});

bench.warmupTime = 100;
return bench;
};

const blake3_1kb: BenchFn = () => {
const data = rnqc.randomBytes(1024);

const bench = new Bench({
name: 'blake3 1KB input',
time: TIME_MS,
});

bench
.add('rnqc', () => {
rnqc.blake3(data);
})
.add('@noble/hashes/blake3', () => {
nobleBlake3(data);
});

bench.warmupTime = 100;
return bench;
};

const blake3_64kb: BenchFn = () => {
const data = rnqc.randomBytes(64 * 1024);

const bench = new Bench({
name: 'blake3 64KB input',
time: TIME_MS,
});

bench
.add('rnqc', () => {
rnqc.blake3(data);
})
.add('@noble/hashes/blake3', () => {
nobleBlake3(data);
});

bench.warmupTime = 100;
return bench;
};

const blake3_xof_256b: BenchFn = () => {
const data = rnqc.randomBytes(32);

const bench = new Bench({
name: 'blake3 XOF 256b output',
time: TIME_MS,
});

bench
.add('rnqc', () => {
rnqc.blake3(data, { dkLen: 256 });
})
.add('@noble/hashes/blake3', () => {
nobleBlake3(data, { dkLen: 256 });
});

bench.warmupTime = 100;
return bench;
};

const blake3_keyed: BenchFn = () => {
const data = rnqc.randomBytes(64);
const key = rnqc.randomBytes(32);

const bench = new Bench({
name: 'blake3 keyed MAC',
time: TIME_MS,
});

bench
.add('rnqc', () => {
rnqc.blake3(data, { key });
})
.add('@noble/hashes/blake3', () => {
nobleBlake3(data, { key });
});

bench.warmupTime = 100;
return bench;
};

const blake3_streaming: BenchFn = () => {
const chunk1 = rnqc.randomBytes(512);
const chunk2 = rnqc.randomBytes(512);

const bench = new Bench({
name: 'blake3 streaming (2x 512b)',
time: TIME_MS,
});

bench
.add('rnqc', () => {
const h = rnqc.createBlake3();
h.update(chunk1);
h.update(chunk2);
h.digest();
})
.add('@noble/hashes/blake3', () => {
const h = nobleBlake3.create({});
h.update(chunk1);
h.update(chunk2);
h.digest();
});

bench.warmupTime = 100;
return bench;
};

export default [
blake3_32b,
blake3_1kb,
blake3_64kb,
blake3_xof_256b,
blake3_keyed,
blake3_streaming,
];
2 changes: 2 additions & 0 deletions example/src/hooks/useBenchmarks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useState } from 'react';
import { BenchmarkSuite } from '../benchmarks/benchmarks';
import blake3 from '../benchmarks/blake3/blake3';
import ed from '../benchmarks/ed/ed25519';
import pbkdf2 from '../benchmarks/pbkdf2/pbkdf2';
import random from '../benchmarks/random/randomBytes';
Expand All @@ -19,6 +20,7 @@ export const useBenchmarks = (): [
// initial load of benchmark suites
useEffect(() => {
const newSuites: BenchmarkSuite[] = [];
newSuites.push(new BenchmarkSuite('blake3', blake3));
newSuites.push(new BenchmarkSuite('ed', ed));
newSuites.push(new BenchmarkSuite('pbkdf2', pbkdf2));
newSuites.push(
Expand Down
5 changes: 3 additions & 2 deletions example/src/hooks/useTestsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useState, useCallback } from 'react';
import type { TestSuites } from '../types/tests';
import { TestsContext } from '../tests/util';

import '../tests/blake3/blake3_tests';
import '../tests/cipher/cipher_tests';
import '../tests/cipher/chacha_tests';
import '../tests/cipher/xsalsa20_tests';
Expand All @@ -13,9 +14,9 @@ import '../tests/pbkdf2/pbkdf2_tests';
import '../tests/random/random_tests';
import '../tests/subtle/deriveBits';
import '../tests/subtle/digest';
import '../tests/subtle/encrypt_decrypt';
// import '../tests/subtle/encrypt_decrypt';
import '../tests/subtle/generateKey';
import '../tests/subtle/import_export';
// import '../tests/subtle/import_export';
import '../tests/subtle/sign_verify';

export const useTestsList = (): [
Expand Down
2 changes: 2 additions & 0 deletions example/src/navigators/children/TestDetailsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const TestDetailsScreen = ({ route }) => {
disableText={true}
fillColor="red"
style={styles.checkbox}
testID="show-failed-checkbox"
/>
<Text style={styles.showMenuLabel}>Show Failed</Text>
</View>
Expand All @@ -41,6 +42,7 @@ export const TestDetailsScreen = ({ route }) => {
disableText={true}
fillColor={colors.green}
style={styles.checkbox}
testID="show-passed-checkbox"
/>
<Text style={styles.showMenuLabel}>Show Passed</Text>
</View>
Expand Down
5 changes: 4 additions & 1 deletion example/src/navigators/children/TestSuitesScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export const TestSuitesScreen = () => {
0,
)}
</Text>
<Text style={[styles.fail, styles.statNumber]}>
<Text
style={[styles.fail, styles.statNumber]}
testID="total-fail-count"
>
{Object.values(results).reduce(
(sum, suite) =>
sum + suite.results.filter(r => r.type === 'incorrect').length,
Expand Down
Loading
Loading