diff --git a/bun.lock b/bun.lock index e2d40e0c..3bd15645 100644 --- a/bun.lock +++ b/bun.lock @@ -33,7 +33,7 @@ "dependencies": { "@noble/ciphers": "2.0.1", "@noble/curves": "1.7.0", - "@noble/hashes": "1.5.0", + "@noble/hashes": "2.2.0", "@react-navigation/bottom-tabs": "7.16.0", "@react-navigation/native": "7.2.4", "@react-navigation/native-stack": "7.15.0", @@ -569,7 +569,7 @@ "@noble/curves": ["@noble/curves@1.7.0", "", { "dependencies": { "@noble/hashes": "1.6.0" } }, "sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw=="], - "@noble/hashes": ["@noble/hashes@1.5.0", "", {}, "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA=="], + "@noble/hashes": ["@noble/hashes@2.2.0", "", {}, "sha512-IYqDGiTXab6FniAgnSdZwgWbomxpy9FtYvLKs7wCUs2a8RkITG+DFGO1DM9cr+E3/RgADRpFjrKVaJ1z6sjtEg=="], "@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="], diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index ed46311b..abb99ee1 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -2815,7 +2815,7 @@ SPEC CHECKSUMS: NitroMmkv: afbc5b2fbf963be567c6c545aa1efcf6a9cec68e NitroModules: 11bba9d065af151eae51e38a6425e04c3b223ff3 OpenSSL-Universal: 9110d21982bb7e8b22a962b6db56a8aa805afde7 - QuickCrypto: 6da296072ca4df238901a2055023af9558ae1d01 + QuickCrypto: 6b271caaa2f24335a4bc545bb856984f1001d7e4 RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669 RCTDeprecation: c4b9e2fd0ab200e3af72b013ed6113187c607077 RCTRequired: e97dd5dafc1db8094e63bc5031e0371f092ae92a diff --git a/example/package.json b/example/package.json index 61374d3a..05ffa1f8 100644 --- a/example/package.json +++ b/example/package.json @@ -24,7 +24,7 @@ "dependencies": { "@noble/ciphers": "2.0.1", "@noble/curves": "1.7.0", - "@noble/hashes": "1.5.0", + "@noble/hashes": "2.2.0", "@react-navigation/bottom-tabs": "7.16.0", "@react-navigation/native": "7.2.4", "@react-navigation/native-stack": "7.15.0", diff --git a/example/src/benchmarks/blake3/blake3.ts b/example/src/benchmarks/blake3/blake3.ts index 3f9036b1..6dd10434 100644 --- a/example/src/benchmarks/blake3/blake3.ts +++ b/example/src/benchmarks/blake3/blake3.ts @@ -1,5 +1,5 @@ import rnqc from 'react-native-quick-crypto'; -import { blake3 as nobleBlake3 } from '@noble/hashes/blake3'; +import { blake3 as nobleBlake3 } from '@noble/hashes/blake3.js'; import type { BenchFn } from '../../types/benchmarks'; import { Bench } from 'tinybench'; diff --git a/example/src/benchmarks/hash/hash.ts b/example/src/benchmarks/hash/hash.ts index 65f43eae..209faf51 100644 --- a/example/src/benchmarks/hash/hash.ts +++ b/example/src/benchmarks/hash/hash.ts @@ -1,5 +1,6 @@ import rnqc from 'react-native-quick-crypto'; -import { sha256 } from '@noble/hashes/sha2'; +import { sha256 } from '@noble/hashes/sha2.js'; +import { utf8ToBytes } from '@noble/hashes/utils.js'; // @ts-expect-error - crypto-browserify is not typed import browserify from 'crypto-browserify'; import type { BenchFn } from '../../types/benchmarks'; @@ -21,7 +22,7 @@ const hash_sha256_8mb_string: BenchFn = () => { hash.digest('hex'); }) .add('@noble/hashes/sha256', () => { - sha256(text8MB); + sha256(utf8ToBytes(text8MB)); }) .add('browserify', () => { const hash = browserify.createHash('sha256'); @@ -47,7 +48,7 @@ const hash_sha256_1mb_string: BenchFn = () => { hash.digest('hex'); }) .add('@noble/hashes/sha256', () => { - sha256(text1MB); + sha256(utf8ToBytes(text1MB)); }) .add('browserify', () => { const hash = browserify.createHash('sha256'); diff --git a/example/src/benchmarks/hkdf/hkdf.ts b/example/src/benchmarks/hkdf/hkdf.ts index 8126defd..6b8001e2 100644 --- a/example/src/benchmarks/hkdf/hkdf.ts +++ b/example/src/benchmarks/hkdf/hkdf.ts @@ -1,6 +1,6 @@ import rnqc, { Buffer } from 'react-native-quick-crypto'; -import { hkdf } from '@noble/hashes/hkdf'; -import { sha256 } from '@noble/hashes/sha2'; +import { hkdf } from '@noble/hashes/hkdf.js'; +import { sha256 } from '@noble/hashes/sha2.js'; import type { BenchFn } from '../../types/benchmarks'; import { Bench } from 'tinybench'; diff --git a/example/src/benchmarks/hmac/hmac.ts b/example/src/benchmarks/hmac/hmac.ts index e998e3bf..574f96af 100644 --- a/example/src/benchmarks/hmac/hmac.ts +++ b/example/src/benchmarks/hmac/hmac.ts @@ -1,13 +1,15 @@ import rnqc from 'react-native-quick-crypto'; // @ts-expect-error - crypto-browserify is not typed import browserify from 'crypto-browserify'; -import { hmac } from '@noble/hashes/hmac'; -import { sha256 } from '@noble/hashes/sha2'; +import { hmac } from '@noble/hashes/hmac.js'; +import { sha256 } from '@noble/hashes/sha2.js'; +import { utf8ToBytes } from '@noble/hashes/utils.js'; import type { BenchFn } from '../../types/benchmarks'; import { Bench } from 'tinybench'; import { text1MB, text8MB, buffer1MB, buffer8MB } from '../testData'; const hmacKey = 'test-key-for-hmac-benchmarks'; +const hmacKeyBytes = utf8ToBytes(hmacKey); const hmac_sha256_8mb_string: BenchFn = () => { const bench = new Bench({ @@ -24,7 +26,7 @@ const hmac_sha256_8mb_string: BenchFn = () => { h.digest('hex'); }) .add('@noble/hashes/hmac', () => { - hmac(sha256, hmacKey, text8MB); + hmac(sha256, hmacKeyBytes, utf8ToBytes(text8MB)); }) .add('browserify', () => { const h = browserify.createHmac('sha256', hmacKey); @@ -50,7 +52,7 @@ const hmac_sha256_1mb_string: BenchFn = () => { h.digest('hex'); }) .add('@noble/hashes/hmac', () => { - hmac(sha256, hmacKey, text1MB); + hmac(sha256, hmacKeyBytes, utf8ToBytes(text1MB)); }) .add('browserify', () => { const h = browserify.createHmac('sha256', hmacKey); @@ -76,7 +78,7 @@ const hmac_sha256_8mb_buffer: BenchFn = () => { h.digest('hex'); }) .add('@noble/hashes/hmac', () => { - hmac(sha256, hmacKey, buffer8MB); + hmac(sha256, hmacKeyBytes, buffer8MB); }) .add('browserify', () => { const h = browserify.createHmac('sha256', hmacKey); @@ -102,7 +104,7 @@ const hmac_sha256_1mb_buffer: BenchFn = () => { h.digest('hex'); }) .add('@noble/hashes/hmac', () => { - hmac(sha256, hmacKey, buffer1MB); + hmac(sha256, hmacKeyBytes, buffer1MB); }) .add('browserify', () => { const h = browserify.createHmac('sha256', hmacKey); diff --git a/example/src/benchmarks/pbkdf2/pbkdf2.ts b/example/src/benchmarks/pbkdf2/pbkdf2.ts index 8c96f03f..d1582976 100644 --- a/example/src/benchmarks/pbkdf2/pbkdf2.ts +++ b/example/src/benchmarks/pbkdf2/pbkdf2.ts @@ -1,6 +1,6 @@ import rnqc from 'react-native-quick-crypto'; -import * as noble from '@noble/hashes/pbkdf2'; -import { sha256 } from '@noble/hashes/sha2'; +import * as noble from '@noble/hashes/pbkdf2.js'; +import { sha256 } from '@noble/hashes/sha2.js'; // @ts-expect-error - crypto-browserify is not typed import browserify from 'crypto-browserify'; import type { BenchFn } from '../../types/benchmarks'; diff --git a/example/src/benchmarks/scrypt/scrypt.ts b/example/src/benchmarks/scrypt/scrypt.ts index 1314c73b..441aba78 100644 --- a/example/src/benchmarks/scrypt/scrypt.ts +++ b/example/src/benchmarks/scrypt/scrypt.ts @@ -1,5 +1,5 @@ import rnqc from 'react-native-quick-crypto'; -import * as noble from '@noble/hashes/scrypt'; +import * as noble from '@noble/hashes/scrypt.js'; import type { BenchFn } from '../../types/benchmarks'; import { Bench } from 'tinybench';