react-native-quick-crypto 1.0.0-beta.2 → 1.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/QuickCrypto.podspec +143 -7
- package/README.md +12 -6
- package/android/CMakeLists.txt +82 -21
- package/android/build.gradle +47 -4
- package/android/src/main/cpp/cpp-adapter.cpp +3 -10
- package/android/src/main/java/com/margelo/nitro/quickcrypto/QuickCryptoPackage.java +13 -10
- package/app.plugin.js +3 -0
- package/cpp/blake3/HybridBlake3.cpp +118 -0
- package/cpp/blake3/HybridBlake3.hpp +35 -0
- package/cpp/cipher/CCMCipher.cpp +199 -0
- package/cpp/cipher/CCMCipher.hpp +26 -0
- package/cpp/cipher/ChaCha20Cipher.cpp +97 -0
- package/cpp/cipher/ChaCha20Cipher.hpp +25 -0
- package/cpp/cipher/ChaCha20Poly1305Cipher.cpp +170 -0
- package/cpp/cipher/ChaCha20Poly1305Cipher.hpp +30 -0
- package/cpp/cipher/HybridCipher.cpp +322 -0
- package/cpp/cipher/HybridCipher.hpp +68 -0
- package/cpp/cipher/HybridCipherFactory.hpp +97 -0
- package/cpp/cipher/OCBCipher.cpp +55 -0
- package/cpp/cipher/OCBCipher.hpp +19 -0
- package/cpp/cipher/XSalsa20Cipher.cpp +61 -0
- package/cpp/cipher/XSalsa20Cipher.hpp +33 -0
- package/cpp/ec/HybridEcKeyPair.cpp +428 -0
- package/cpp/ec/HybridEcKeyPair.hpp +48 -0
- package/cpp/ed25519/HybridEdKeyPair.cpp +300 -0
- package/cpp/ed25519/HybridEdKeyPair.hpp +63 -0
- package/cpp/hash/HybridHash.cpp +185 -0
- package/cpp/hash/HybridHash.hpp +43 -0
- package/cpp/hmac/HybridHmac.cpp +95 -0
- package/cpp/hmac/HybridHmac.hpp +31 -0
- package/cpp/keys/HybridKeyObjectHandle.cpp +243 -0
- package/cpp/keys/HybridKeyObjectHandle.hpp +42 -0
- package/cpp/keys/KeyObjectData.cpp +226 -0
- package/cpp/keys/KeyObjectData.hpp +71 -0
- package/cpp/keys/node.h +5 -0
- package/cpp/pbkdf2/HybridPbkdf2.cpp +51 -0
- package/cpp/pbkdf2/HybridPbkdf2.hpp +24 -0
- package/cpp/random/HybridRandom.cpp +32 -18
- package/cpp/random/HybridRandom.hpp +18 -30
- package/cpp/rsa/HybridRsaKeyPair.cpp +154 -0
- package/cpp/rsa/HybridRsaKeyPair.hpp +43 -0
- package/cpp/utils/Macros.hpp +68 -0
- package/cpp/utils/Utils.hpp +53 -1
- package/deps/blake3/.cargo/config.toml +2 -0
- package/deps/blake3/.git-blame-ignore-revs +2 -0
- package/deps/blake3/.github/workflows/build_b3sum.py +38 -0
- package/deps/blake3/.github/workflows/ci.yml +491 -0
- package/deps/blake3/.github/workflows/tag.yml +43 -0
- package/deps/blake3/.github/workflows/upload_github_release_asset.py +73 -0
- package/deps/blake3/CONTRIBUTING.md +31 -0
- package/deps/blake3/Cargo.toml +135 -0
- package/deps/blake3/LICENSE_A2 +202 -0
- package/deps/blake3/LICENSE_A2LLVM +219 -0
- package/deps/blake3/LICENSE_CC0 +121 -0
- package/deps/blake3/README.md +229 -0
- package/deps/blake3/b3sum/Cargo.lock +513 -0
- package/deps/blake3/b3sum/Cargo.toml +26 -0
- package/deps/blake3/b3sum/README.md +72 -0
- package/deps/blake3/b3sum/src/main.rs +564 -0
- package/deps/blake3/b3sum/src/unit_tests.rs +235 -0
- package/deps/blake3/b3sum/tests/cli_tests.rs +680 -0
- package/deps/blake3/b3sum/what_does_check_do.md +176 -0
- package/deps/blake3/benches/bench.rs +623 -0
- package/deps/blake3/build.rs +389 -0
- package/deps/blake3/c/CMakeLists.txt +383 -0
- package/deps/blake3/c/CMakePresets.json +73 -0
- package/deps/blake3/c/Makefile.testing +82 -0
- package/deps/blake3/c/README.md +403 -0
- package/deps/blake3/c/blake3-config.cmake.in +14 -0
- package/deps/blake3/c/blake3.c +650 -0
- package/deps/blake3/c/blake3.h +86 -0
- package/deps/blake3/c/blake3_avx2.c +326 -0
- package/deps/blake3/c/blake3_avx2_x86-64_unix.S +1815 -0
- package/deps/blake3/c/blake3_avx2_x86-64_windows_gnu.S +1817 -0
- package/deps/blake3/c/blake3_avx2_x86-64_windows_msvc.asm +1828 -0
- package/deps/blake3/c/blake3_avx512.c +1388 -0
- package/deps/blake3/c/blake3_avx512_x86-64_unix.S +4824 -0
- package/deps/blake3/c/blake3_avx512_x86-64_windows_gnu.S +2615 -0
- package/deps/blake3/c/blake3_avx512_x86-64_windows_msvc.asm +2634 -0
- package/deps/blake3/c/blake3_c_rust_bindings/Cargo.toml +32 -0
- package/deps/blake3/c/blake3_c_rust_bindings/README.md +4 -0
- package/deps/blake3/c/blake3_c_rust_bindings/benches/bench.rs +477 -0
- package/deps/blake3/c/blake3_c_rust_bindings/build.rs +253 -0
- package/deps/blake3/c/blake3_c_rust_bindings/cross_test.sh +31 -0
- package/deps/blake3/c/blake3_c_rust_bindings/src/lib.rs +333 -0
- package/deps/blake3/c/blake3_c_rust_bindings/src/test.rs +696 -0
- package/deps/blake3/c/blake3_dispatch.c +332 -0
- package/deps/blake3/c/blake3_impl.h +333 -0
- package/deps/blake3/c/blake3_neon.c +366 -0
- package/deps/blake3/c/blake3_portable.c +160 -0
- package/deps/blake3/c/blake3_sse2.c +566 -0
- package/deps/blake3/c/blake3_sse2_x86-64_unix.S +2291 -0
- package/deps/blake3/c/blake3_sse2_x86-64_windows_gnu.S +2332 -0
- package/deps/blake3/c/blake3_sse2_x86-64_windows_msvc.asm +2350 -0
- package/deps/blake3/c/blake3_sse41.c +560 -0
- package/deps/blake3/c/blake3_sse41_x86-64_unix.S +2028 -0
- package/deps/blake3/c/blake3_sse41_x86-64_windows_gnu.S +2069 -0
- package/deps/blake3/c/blake3_sse41_x86-64_windows_msvc.asm +2089 -0
- package/deps/blake3/c/blake3_tbb.cpp +37 -0
- package/deps/blake3/c/dependencies/CMakeLists.txt +3 -0
- package/deps/blake3/c/dependencies/tbb/CMakeLists.txt +28 -0
- package/deps/blake3/c/example.c +36 -0
- package/deps/blake3/c/example_tbb.c +57 -0
- package/deps/blake3/c/libblake3.pc.in +12 -0
- package/deps/blake3/c/main.c +166 -0
- package/deps/blake3/c/test.py +97 -0
- package/deps/blake3/media/B3.svg +70 -0
- package/deps/blake3/media/BLAKE3.svg +85 -0
- package/deps/blake3/media/speed.svg +1474 -0
- package/deps/blake3/reference_impl/Cargo.toml +8 -0
- package/deps/blake3/reference_impl/README.md +14 -0
- package/deps/blake3/reference_impl/reference_impl.rs +374 -0
- package/deps/blake3/src/ffi_avx2.rs +65 -0
- package/deps/blake3/src/ffi_avx512.rs +169 -0
- package/deps/blake3/src/ffi_neon.rs +82 -0
- package/deps/blake3/src/ffi_sse2.rs +126 -0
- package/deps/blake3/src/ffi_sse41.rs +126 -0
- package/deps/blake3/src/guts.rs +60 -0
- package/deps/blake3/src/hazmat.rs +704 -0
- package/deps/blake3/src/io.rs +64 -0
- package/deps/blake3/src/join.rs +92 -0
- package/deps/blake3/src/lib.rs +1835 -0
- package/deps/blake3/src/platform.rs +587 -0
- package/deps/blake3/src/portable.rs +198 -0
- package/deps/blake3/src/rust_avx2.rs +474 -0
- package/deps/blake3/src/rust_sse2.rs +775 -0
- package/deps/blake3/src/rust_sse41.rs +766 -0
- package/deps/blake3/src/test.rs +1049 -0
- package/deps/blake3/src/traits.rs +227 -0
- package/deps/blake3/src/wasm32_simd.rs +794 -0
- package/deps/blake3/test_vectors/Cargo.toml +19 -0
- package/deps/blake3/test_vectors/cross_test.sh +25 -0
- package/deps/blake3/test_vectors/src/bin/generate.rs +4 -0
- package/deps/blake3/test_vectors/src/lib.rs +350 -0
- package/deps/blake3/test_vectors/test_vectors.json +217 -0
- package/deps/blake3/tools/compiler_version/Cargo.toml +7 -0
- package/deps/blake3/tools/compiler_version/build.rs +6 -0
- package/deps/blake3/tools/compiler_version/src/main.rs +27 -0
- package/deps/blake3/tools/instruction_set_support/Cargo.toml +6 -0
- package/deps/blake3/tools/instruction_set_support/src/main.rs +10 -0
- package/deps/blake3/tools/release.md +16 -0
- package/deps/fastpbkdf2/fastpbkdf2.c +356 -0
- package/deps/fastpbkdf2/fastpbkdf2.h +68 -0
- package/deps/ncrypto/ncrypto.cc +4679 -0
- package/deps/ncrypto/ncrypto.h +1625 -0
- package/lib/commonjs/blake3.js +98 -0
- package/lib/commonjs/blake3.js.map +1 -0
- package/lib/commonjs/cipher.js +180 -0
- package/lib/commonjs/cipher.js.map +1 -0
- package/lib/commonjs/ec.js +344 -0
- package/lib/commonjs/ec.js.map +1 -0
- package/lib/commonjs/ed.js +185 -0
- package/lib/commonjs/ed.js.map +1 -0
- package/lib/commonjs/expo-plugin/@types.js +2 -0
- package/lib/commonjs/expo-plugin/@types.js.map +1 -0
- package/lib/commonjs/expo-plugin/withRNQC.js +25 -0
- package/lib/commonjs/expo-plugin/withRNQC.js.map +1 -0
- package/lib/commonjs/expo-plugin/withSodiumAndroid.js +25 -0
- package/lib/commonjs/expo-plugin/withSodiumAndroid.js.map +1 -0
- package/lib/commonjs/expo-plugin/withSodiumIos.js +26 -0
- package/lib/commonjs/expo-plugin/withSodiumIos.js.map +1 -0
- package/lib/commonjs/expo-plugin/withXCode.js +51 -0
- package/lib/commonjs/expo-plugin/withXCode.js.map +1 -0
- package/lib/commonjs/hash.js +215 -0
- package/lib/commonjs/hash.js.map +1 -0
- package/lib/commonjs/hmac.js +109 -0
- package/lib/commonjs/hmac.js.map +1 -0
- package/lib/commonjs/index.js +152 -32
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/keys/classes.js +250 -0
- package/lib/commonjs/keys/classes.js.map +1 -0
- package/lib/commonjs/keys/generateKeyPair.js +102 -0
- package/lib/commonjs/keys/generateKeyPair.js.map +1 -0
- package/lib/commonjs/keys/index.js +89 -0
- package/lib/commonjs/keys/index.js.map +1 -0
- package/lib/commonjs/keys/signVerify.js +41 -0
- package/lib/commonjs/keys/signVerify.js.map +1 -0
- package/lib/commonjs/keys/utils.js +123 -0
- package/lib/commonjs/keys/utils.js.map +1 -0
- package/lib/commonjs/pbkdf2.js +89 -0
- package/lib/commonjs/pbkdf2.js.map +1 -0
- package/lib/commonjs/random.js +9 -3
- package/lib/commonjs/random.js.map +1 -1
- package/lib/commonjs/rsa.js +129 -0
- package/lib/commonjs/rsa.js.map +1 -0
- package/lib/commonjs/specs/blake3.nitro.js +6 -0
- package/lib/commonjs/specs/blake3.nitro.js.map +1 -0
- package/lib/commonjs/specs/cipher.nitro.js +6 -0
- package/lib/commonjs/specs/cipher.nitro.js.map +1 -0
- package/lib/commonjs/specs/ecKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/ecKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/specs/edKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/edKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/specs/hash.nitro.js +6 -0
- package/lib/commonjs/specs/hash.nitro.js.map +1 -0
- package/lib/commonjs/specs/hmac.nitro.js +6 -0
- package/lib/commonjs/specs/hmac.nitro.js.map +1 -0
- package/lib/commonjs/specs/keyObjectHandle.nitro.js +6 -0
- package/lib/commonjs/specs/keyObjectHandle.nitro.js.map +1 -0
- package/lib/commonjs/specs/pbkdf2.nitro.js +6 -0
- package/lib/commonjs/specs/pbkdf2.nitro.js.map +1 -0
- package/lib/commonjs/specs/rsaKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/rsaKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/subtle.js +365 -0
- package/lib/commonjs/subtle.js.map +1 -0
- package/lib/commonjs/utils/cipher.js +64 -0
- package/lib/commonjs/utils/cipher.js.map +1 -0
- package/lib/commonjs/utils/conversion.js +140 -6
- package/lib/commonjs/utils/conversion.js.map +1 -1
- package/lib/commonjs/utils/errors.js +14 -0
- package/lib/commonjs/utils/errors.js.map +1 -0
- package/lib/commonjs/utils/hashnames.js +91 -0
- package/lib/commonjs/utils/hashnames.js.map +1 -0
- package/lib/commonjs/utils/index.js +65 -5
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/noble.js +82 -0
- package/lib/commonjs/utils/noble.js.map +1 -0
- package/lib/commonjs/utils/types.js +52 -0
- package/lib/commonjs/utils/types.js.map +1 -1
- package/lib/commonjs/utils/validation.js +98 -0
- package/lib/commonjs/utils/validation.js.map +1 -0
- package/lib/module/blake3.js +90 -0
- package/lib/module/blake3.js.map +1 -0
- package/lib/module/cipher.js +173 -0
- package/lib/module/cipher.js.map +1 -0
- package/lib/module/ec.js +336 -0
- package/lib/module/ec.js.map +1 -0
- package/lib/module/ed.js +178 -0
- package/lib/module/ed.js.map +1 -0
- package/lib/module/expo-plugin/@types.js +2 -0
- package/lib/module/expo-plugin/@types.js.map +1 -0
- package/lib/module/expo-plugin/withRNQC.js +21 -0
- package/lib/module/expo-plugin/withRNQC.js.map +1 -0
- package/lib/module/expo-plugin/withSodiumAndroid.js +20 -0
- package/lib/module/expo-plugin/withSodiumAndroid.js.map +1 -0
- package/lib/module/expo-plugin/withSodiumIos.js +20 -0
- package/lib/module/expo-plugin/withSodiumIos.js.map +1 -0
- package/lib/module/expo-plugin/withXCode.js +46 -0
- package/lib/module/expo-plugin/withXCode.js.map +1 -0
- package/lib/module/hash.js +207 -0
- package/lib/module/hash.js.map +1 -0
- package/lib/module/hmac.js +104 -0
- package/lib/module/hmac.js.map +1 -0
- package/lib/module/index.js +33 -29
- package/lib/module/index.js.map +1 -1
- package/lib/module/keys/classes.js +241 -0
- package/lib/module/keys/classes.js.map +1 -0
- package/lib/module/keys/generateKeyPair.js +96 -0
- package/lib/module/keys/generateKeyPair.js.map +1 -0
- package/lib/module/keys/index.js +32 -0
- package/lib/module/keys/index.js.map +1 -0
- package/lib/module/keys/signVerify.js +41 -0
- package/lib/module/keys/signVerify.js.map +1 -0
- package/lib/module/keys/utils.js +114 -0
- package/lib/module/keys/utils.js.map +1 -0
- package/lib/module/pbkdf2.js +83 -0
- package/lib/module/pbkdf2.js.map +1 -0
- package/lib/module/random.js +7 -1
- package/lib/module/random.js.map +1 -1
- package/lib/module/rsa.js +123 -0
- package/lib/module/rsa.js.map +1 -0
- package/lib/module/specs/blake3.nitro.js +4 -0
- package/lib/module/specs/blake3.nitro.js.map +1 -0
- package/lib/module/specs/cipher.nitro.js +4 -0
- package/lib/module/specs/cipher.nitro.js.map +1 -0
- package/lib/module/specs/ecKeyPair.nitro.js +4 -0
- package/lib/module/specs/ecKeyPair.nitro.js.map +1 -0
- package/lib/module/specs/edKeyPair.nitro.js +4 -0
- package/lib/module/specs/edKeyPair.nitro.js.map +1 -0
- package/lib/module/specs/hash.nitro.js +4 -0
- package/lib/module/specs/hash.nitro.js.map +1 -0
- package/lib/module/specs/hmac.nitro.js +4 -0
- package/lib/module/specs/hmac.nitro.js.map +1 -0
- package/lib/module/specs/keyObjectHandle.nitro.js +4 -0
- package/lib/module/specs/keyObjectHandle.nitro.js.map +1 -0
- package/lib/module/specs/pbkdf2.nitro.js +4 -0
- package/lib/module/specs/pbkdf2.nitro.js.map +1 -0
- package/lib/module/specs/rsaKeyPair.nitro.js +4 -0
- package/lib/module/specs/rsaKeyPair.nitro.js.map +1 -0
- package/lib/module/subtle.js +360 -0
- package/lib/module/subtle.js.map +1 -0
- package/lib/module/utils/cipher.js +56 -0
- package/lib/module/utils/cipher.js.map +1 -0
- package/lib/module/utils/conversion.js +120 -8
- package/lib/module/utils/conversion.js.map +1 -1
- package/lib/module/utils/errors.js +10 -0
- package/lib/module/utils/errors.js.map +1 -0
- package/lib/module/utils/hashnames.js +89 -0
- package/lib/module/utils/hashnames.js.map +1 -0
- package/lib/module/utils/index.js +6 -5
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/noble.js +76 -0
- package/lib/module/utils/noble.js.map +1 -0
- package/lib/module/utils/types.js +53 -0
- package/lib/module/utils/types.js.map +1 -1
- package/lib/module/utils/validation.js +87 -0
- package/lib/module/utils/validation.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/typescript/blake3.d.ts +33 -0
- package/lib/typescript/blake3.d.ts.map +1 -0
- package/lib/typescript/cipher.d.ts +60 -0
- package/lib/typescript/cipher.d.ts.map +1 -0
- package/lib/typescript/ec.d.ts +13 -0
- package/lib/typescript/ec.d.ts.map +1 -0
- package/lib/typescript/ed.d.ts +43 -0
- package/lib/typescript/ed.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/@types.d.ts +8 -0
- package/lib/typescript/expo-plugin/@types.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withRNQC.d.ts +4 -0
- package/lib/typescript/expo-plugin/withRNQC.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withSodiumAndroid.d.ts +4 -0
- package/lib/typescript/expo-plugin/withSodiumAndroid.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withSodiumIos.d.ts +4 -0
- package/lib/typescript/expo-plugin/withSodiumIos.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withXCode.d.ts +9 -0
- package/lib/typescript/expo-plugin/withXCode.d.ts.map +1 -0
- package/lib/typescript/hash.d.ts +122 -0
- package/lib/typescript/hash.d.ts.map +1 -0
- package/lib/typescript/hmac.d.ts +66 -0
- package/lib/typescript/hmac.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +110 -9
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/keys/classes.d.ts +79 -0
- package/lib/typescript/keys/classes.d.ts.map +1 -0
- package/lib/typescript/keys/generateKeyPair.d.ts +6 -0
- package/lib/typescript/keys/generateKeyPair.d.ts.map +1 -0
- package/lib/typescript/keys/index.d.ts +7 -0
- package/lib/typescript/keys/index.d.ts.map +1 -0
- package/lib/typescript/keys/signVerify.d.ts +1 -0
- package/lib/typescript/keys/signVerify.d.ts.map +1 -0
- package/lib/typescript/keys/utils.d.ts +34 -0
- package/lib/typescript/keys/utils.d.ts.map +1 -0
- package/lib/typescript/pbkdf2.d.ts +12 -0
- package/lib/typescript/pbkdf2.d.ts.map +1 -0
- package/lib/typescript/random.d.ts +11 -5
- package/lib/typescript/random.d.ts.map +1 -1
- package/lib/typescript/rsa.d.ts +10 -0
- package/lib/typescript/rsa.d.ts.map +1 -0
- package/lib/typescript/specs/blake3.nitro.d.ts +15 -0
- package/lib/typescript/specs/blake3.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/cipher.nitro.d.ts +29 -0
- package/lib/typescript/specs/cipher.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/ecKeyPair.nitro.d.ts +20 -0
- package/lib/typescript/specs/ecKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/edKeyPair.nitro.d.ts +17 -0
- package/lib/typescript/specs/edKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/hash.nitro.d.ts +13 -0
- package/lib/typescript/specs/hash.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/hmac.nitro.d.ts +10 -0
- package/lib/typescript/specs/hmac.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/keyObjectHandle.nitro.d.ts +14 -0
- package/lib/typescript/specs/keyObjectHandle.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/pbkdf2.nitro.d.ts +9 -0
- package/lib/typescript/specs/pbkdf2.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/rsaKeyPair.nitro.d.ts +20 -0
- package/lib/typescript/specs/rsaKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/subtle.d.ts +17 -0
- package/lib/typescript/subtle.d.ts.map +1 -0
- package/lib/typescript/utils/cipher.d.ts +7 -0
- package/lib/typescript/utils/cipher.d.ts.map +1 -0
- package/lib/typescript/utils/conversion.d.ts +24 -2
- package/lib/typescript/utils/conversion.d.ts.map +1 -1
- package/lib/typescript/utils/errors.d.ts +7 -0
- package/lib/typescript/utils/errors.d.ts.map +1 -0
- package/lib/typescript/utils/hashnames.d.ts +13 -0
- package/lib/typescript/utils/hashnames.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts +6 -5
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/lib/typescript/utils/noble.d.ts +19 -0
- package/lib/typescript/utils/noble.d.ts.map +1 -0
- package/lib/typescript/utils/types.d.ts +252 -2
- package/lib/typescript/utils/types.d.ts.map +1 -1
- package/lib/typescript/utils/validation.d.ts +13 -0
- package/lib/typescript/utils/validation.d.ts.map +1 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/QuickCrypto+autolinking.cmake +47 -4
- package/nitrogen/generated/android/QuickCrypto+autolinking.gradle +4 -3
- package/nitrogen/generated/android/QuickCryptoOnLoad.cpp +144 -0
- package/nitrogen/generated/android/QuickCryptoOnLoad.hpp +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/crypto/QuickCryptoOnLoad.kt +35 -0
- package/nitrogen/generated/ios/QuickCrypto+autolinking.rb +11 -8
- package/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.cpp +11 -3
- package/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.hpp +5 -3
- package/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Umbrella.hpp +16 -7
- package/nitrogen/generated/ios/QuickCryptoAutolinking.mm +135 -0
- package/nitrogen/generated/ios/QuickCryptoAutolinking.swift +12 -0
- package/nitrogen/generated/shared/c++/CFRGKeyPairType.hpp +84 -0
- package/nitrogen/generated/shared/c++/CipherArgs.hpp +86 -0
- package/nitrogen/generated/shared/c++/HybridBlake3Spec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridBlake3Spec.hpp +76 -0
- package/nitrogen/generated/shared/c++/HybridCipherFactorySpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridCipherFactorySpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridCipherSpec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridCipherSpec.hpp +76 -0
- package/nitrogen/generated/shared/c++/HybridEcKeyPairSpec.cpp +29 -0
- package/nitrogen/generated/shared/c++/HybridEcKeyPairSpec.hpp +77 -0
- package/nitrogen/generated/shared/c++/HybridEdKeyPairSpec.cpp +30 -0
- package/nitrogen/generated/shared/c++/HybridEdKeyPairSpec.hpp +75 -0
- package/nitrogen/generated/shared/c++/HybridHashSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridHashSpec.hpp +75 -0
- package/nitrogen/generated/shared/c++/HybridHmacSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridHmacSpec.hpp +66 -0
- package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.hpp +92 -0
- package/nitrogen/generated/shared/c++/HybridPbkdf2Spec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridPbkdf2Spec.hpp +66 -0
- package/nitrogen/generated/shared/c++/HybridRandomSpec.cpp +2 -3
- package/nitrogen/generated/shared/c++/HybridRandomSpec.hpp +9 -6
- package/nitrogen/generated/shared/c++/HybridRsaKeyPairSpec.cpp +29 -0
- package/nitrogen/generated/shared/c++/HybridRsaKeyPairSpec.hpp +77 -0
- package/nitrogen/generated/shared/c++/JWK.hpp +161 -0
- package/nitrogen/generated/shared/c++/JWKkty.hpp +84 -0
- package/nitrogen/generated/shared/c++/JWKuse.hpp +76 -0
- package/nitrogen/generated/shared/c++/KFormatType.hpp +63 -0
- package/nitrogen/generated/shared/c++/KeyDetail.hpp +92 -0
- package/nitrogen/generated/shared/c++/KeyEncoding.hpp +64 -0
- package/nitrogen/generated/shared/c++/KeyObject.hpp +67 -0
- package/nitrogen/generated/shared/c++/KeyType.hpp +63 -0
- package/nitrogen/generated/shared/c++/KeyUsage.hpp +116 -0
- package/nitrogen/generated/shared/c++/NamedCurve.hpp +80 -0
- package/package.json +66 -39
- package/src/blake3.ts +123 -0
- package/src/cipher.ts +335 -0
- package/src/ec.ts +432 -0
- package/src/ed.ts +256 -0
- package/src/expo-plugin/@types.ts +7 -0
- package/src/expo-plugin/withRNQC.ts +23 -0
- package/src/expo-plugin/withSodiumAndroid.ts +24 -0
- package/src/expo-plugin/withSodiumIos.ts +30 -0
- package/src/expo-plugin/withXCode.ts +55 -0
- package/src/hash.ts +274 -0
- package/src/hmac.ts +135 -0
- package/src/index.ts +32 -29
- package/src/keys/classes.ts +317 -0
- package/src/keys/generateKeyPair.ts +145 -0
- package/src/keys/index.ts +52 -0
- package/src/keys/signVerify.ts +39 -0
- package/src/keys/utils.ts +190 -0
- package/src/pbkdf2.ts +154 -0
- package/src/random.ts +26 -23
- package/src/rsa.ts +176 -0
- package/src/specs/blake3.nitro.ts +12 -0
- package/src/specs/cipher.nitro.ts +25 -0
- package/src/specs/ecKeyPair.nitro.ts +38 -0
- package/src/specs/edKeyPair.nitro.ts +43 -0
- package/src/specs/hash.nitro.ts +10 -0
- package/src/specs/hmac.nitro.ts +7 -0
- package/src/specs/keyObjectHandle.nitro.ts +31 -0
- package/src/specs/pbkdf2.nitro.ts +18 -0
- package/src/specs/random.nitro.ts +2 -2
- package/src/specs/rsaKeyPair.nitro.ts +33 -0
- package/src/subtle.ts +614 -0
- package/src/utils/cipher.ts +60 -0
- package/src/utils/conversion.ts +143 -9
- package/src/utils/errors.ts +15 -0
- package/src/utils/hashnames.ts +98 -0
- package/src/utils/index.ts +6 -6
- package/src/utils/noble.ts +85 -0
- package/src/utils/types.ts +423 -3
- package/src/utils/validation.ts +130 -0
- package/ios/QuickCryptoOnLoad.mm +0 -19
- package/lib/module/package.json +0 -1
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- "*"
|
|
7
|
+
# not on tags
|
|
8
|
+
pull_request:
|
|
9
|
+
|
|
10
|
+
env:
|
|
11
|
+
BLAKE3_CI: "1"
|
|
12
|
+
RUSTFLAGS: "-D warnings"
|
|
13
|
+
RUST_BACKTRACE: "1"
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
library_tests:
|
|
17
|
+
name: ${{ matrix.target.name }} ${{ matrix.channel }}
|
|
18
|
+
runs-on: ${{ matrix.target.os }}
|
|
19
|
+
strategy:
|
|
20
|
+
fail-fast: false
|
|
21
|
+
matrix:
|
|
22
|
+
target: [
|
|
23
|
+
{ "os": "ubuntu-latest", "toolchain": "x86_64-unknown-linux-gnu", "name": "Linux GNU" },
|
|
24
|
+
{ "os": "macOS-latest", "toolchain": "aarch64-apple-darwin", "name": "macOS" },
|
|
25
|
+
{ "os": "windows-latest", "toolchain": "x86_64-pc-windows-msvc", "name": "Windows MSVC" },
|
|
26
|
+
{ "os": "windows-latest", "toolchain": "x86_64-pc-windows-gnu", "name": "Windows GNU" }
|
|
27
|
+
]
|
|
28
|
+
channel: ["stable", "beta", "nightly"]
|
|
29
|
+
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
- uses: dtolnay/rust-toolchain@master
|
|
33
|
+
with:
|
|
34
|
+
toolchain: ${{ format('{0}-{1}', matrix.channel, matrix.target.toolchain) }}
|
|
35
|
+
# Print the compiler version, for debugging.
|
|
36
|
+
- name: print compiler version
|
|
37
|
+
run: cargo run --quiet
|
|
38
|
+
working-directory: ./tools/compiler_version
|
|
39
|
+
# Print out instruction set support, for debugging.
|
|
40
|
+
- name: print instruction set support
|
|
41
|
+
run: cargo run --quiet
|
|
42
|
+
working-directory: ./tools/instruction_set_support
|
|
43
|
+
# Default tests plus Rayon and trait implementations.
|
|
44
|
+
- run: cargo test --features=rayon,traits-preview,serde,zeroize
|
|
45
|
+
# Same but with only one thread in the Rayon pool. This can find deadlocks.
|
|
46
|
+
- name: "again with RAYON_NUM_THREADS=1"
|
|
47
|
+
run: cargo test --features=rayon,traits-preview,serde,zeroize
|
|
48
|
+
env:
|
|
49
|
+
RAYON_NUM_THREADS: 1
|
|
50
|
+
# The mmap feature by itself (update_mmap_rayon is omitted).
|
|
51
|
+
- run: cargo test --features=mmap
|
|
52
|
+
# All public features put together.
|
|
53
|
+
- run: cargo test --features=mmap,rayon,traits-preview,serde,zeroize
|
|
54
|
+
# no_std tests.
|
|
55
|
+
- run: cargo test --no-default-features
|
|
56
|
+
|
|
57
|
+
# A matrix of different test settings:
|
|
58
|
+
# - debug vs release
|
|
59
|
+
# - assembly vs Rust+C intrinsics vs pure Rust intrinsics
|
|
60
|
+
# - different levels of SIMD support
|
|
61
|
+
#
|
|
62
|
+
# Full SIMD support.
|
|
63
|
+
- run: cargo test --features=
|
|
64
|
+
- run: cargo test --features=prefer_intrinsics
|
|
65
|
+
- run: cargo test --features=pure
|
|
66
|
+
- run: cargo test --features= --release
|
|
67
|
+
- run: cargo test --features=prefer_intrinsics --release
|
|
68
|
+
- run: cargo test --features=pure --release
|
|
69
|
+
# No AVX-512.
|
|
70
|
+
- run: cargo test --features=no_avx512
|
|
71
|
+
- run: cargo test --features=no_avx512,prefer_intrinsics
|
|
72
|
+
- run: cargo test --features=no_avx512,pure
|
|
73
|
+
- run: cargo test --features=no_avx512 --release
|
|
74
|
+
- run: cargo test --features=no_avx512,prefer_intrinsics --release
|
|
75
|
+
- run: cargo test --features=no_avx512,pure --release
|
|
76
|
+
# No AVX2.
|
|
77
|
+
- run: cargo test --features=no_avx512,no_avx2
|
|
78
|
+
- run: cargo test --features=no_avx512,no_avx2,prefer_intrinsics
|
|
79
|
+
- run: cargo test --features=no_avx512,no_avx2,pure
|
|
80
|
+
- run: cargo test --features=no_avx512,no_avx2 --release
|
|
81
|
+
- run: cargo test --features=no_avx512,no_avx2,prefer_intrinsics --release
|
|
82
|
+
- run: cargo test --features=no_avx512,no_avx2,pure --release
|
|
83
|
+
# No SSE4.1
|
|
84
|
+
- run: cargo test --features=no_avx512,no_avx2,no_sse41
|
|
85
|
+
- run: cargo test --features=no_avx512,no_avx2,no_sse41,prefer_intrinsics
|
|
86
|
+
- run: cargo test --features=no_avx512,no_avx2,no_sse41,pure
|
|
87
|
+
- run: cargo test --features=no_avx512,no_avx2,no_sse41 --release
|
|
88
|
+
- run: cargo test --features=no_avx512,no_avx2,no_sse41,prefer_intrinsics --release
|
|
89
|
+
- run: cargo test --features=no_avx512,no_avx2,no_sse41,pure --release
|
|
90
|
+
# No SSE2
|
|
91
|
+
- run: cargo test --features=no_avx512,no_avx2,no_sse41,no_sse2
|
|
92
|
+
- run: cargo test --features=no_avx512,no_avx2,no_sse41,no_sse2,prefer_intrinsics
|
|
93
|
+
- run: cargo test --features=no_avx512,no_avx2,no_sse41,no_sse2,pure
|
|
94
|
+
- run: cargo test --features=no_avx512,no_avx2,no_sse41,no_sse2 --release
|
|
95
|
+
- run: cargo test --features=no_avx512,no_avx2,no_sse41,no_sse2,prefer_intrinsics --release
|
|
96
|
+
- run: cargo test --features=no_avx512,no_avx2,no_sse41,no_sse2,pure --release
|
|
97
|
+
|
|
98
|
+
# Test benchmarks. RUSTC_BOOTSTRAP=1 lets this run on non-nightly toolchains.
|
|
99
|
+
- run: cargo test --benches --features=rayon
|
|
100
|
+
env:
|
|
101
|
+
RUSTC_BOOTSTRAP: 1
|
|
102
|
+
# Test vectors.
|
|
103
|
+
- name: test vectors
|
|
104
|
+
run: cargo test
|
|
105
|
+
working-directory: ./test_vectors
|
|
106
|
+
- name: test vectors intrinsics
|
|
107
|
+
run: cargo test --features=prefer_intrinsics
|
|
108
|
+
working-directory: ./test_vectors
|
|
109
|
+
- name: test vectors pure
|
|
110
|
+
run: cargo test --features=pure
|
|
111
|
+
working-directory: ./test_vectors
|
|
112
|
+
# Test C code.
|
|
113
|
+
- name: cargo test C bindings assembly
|
|
114
|
+
run: cargo test
|
|
115
|
+
working-directory: ./c/blake3_c_rust_bindings
|
|
116
|
+
- name: cargo test C bindings intrinsics
|
|
117
|
+
run: cargo test --features=prefer_intrinsics
|
|
118
|
+
working-directory: ./c/blake3_c_rust_bindings
|
|
119
|
+
- name: cargo test C bindings no AVX-512
|
|
120
|
+
run: cargo test
|
|
121
|
+
working-directory: ./c/blake3_c_rust_bindings
|
|
122
|
+
env:
|
|
123
|
+
CFLAGS: -DBLAKE3_NO_AVX512
|
|
124
|
+
- name: cargo test C bindings no AVX2
|
|
125
|
+
run: cargo test
|
|
126
|
+
working-directory: ./c/blake3_c_rust_bindings
|
|
127
|
+
env:
|
|
128
|
+
CFLAGS: -DBLAKE3_NO_AVX512 -DBLAKE3_NO_AVX2
|
|
129
|
+
- name: cargo test C bindings no SSE41
|
|
130
|
+
run: cargo test
|
|
131
|
+
working-directory: ./c/blake3_c_rust_bindings
|
|
132
|
+
env:
|
|
133
|
+
CFLAGS: -DBLAKE3_NO_AVX512 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_SSE41
|
|
134
|
+
- name: cargo test C bindings no SSE2
|
|
135
|
+
run: cargo test
|
|
136
|
+
working-directory: ./c/blake3_c_rust_bindings
|
|
137
|
+
env:
|
|
138
|
+
CFLAGS: -DBLAKE3_NO_AVX512 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_SSE41 -DBLAKE3_NO_SSE2
|
|
139
|
+
# Reference impl doc test.
|
|
140
|
+
- name: reference impl doc test
|
|
141
|
+
run: cargo test
|
|
142
|
+
working-directory: ./reference_impl
|
|
143
|
+
|
|
144
|
+
msrv_build:
|
|
145
|
+
name: MSRV build ${{ matrix.os }}
|
|
146
|
+
runs-on: ${{ matrix.os }}
|
|
147
|
+
strategy:
|
|
148
|
+
fail-fast: false
|
|
149
|
+
matrix:
|
|
150
|
+
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
|
|
151
|
+
steps:
|
|
152
|
+
- uses: actions/checkout@v4
|
|
153
|
+
# The current MSRV. This crate doesn't have an official MSRV policy,
|
|
154
|
+
# but in practice we'll probably do what libc does:
|
|
155
|
+
# https://github.com/rust-lang/libs-team/issues/72.
|
|
156
|
+
# This test target is here so that we notice if we accidentally bump
|
|
157
|
+
# the MSRV, but it's not a promise that we won't bump it.
|
|
158
|
+
- uses: dtolnay/rust-toolchain@1.66.1
|
|
159
|
+
- run: cargo build --features=mmap,rayon,traits-preview,serde,zeroize
|
|
160
|
+
|
|
161
|
+
b3sum_tests:
|
|
162
|
+
name: b3sum ${{ matrix.target.name }} ${{ matrix.channel }}
|
|
163
|
+
runs-on: ${{ matrix.target.os }}
|
|
164
|
+
strategy:
|
|
165
|
+
fail-fast: false
|
|
166
|
+
matrix:
|
|
167
|
+
target: [
|
|
168
|
+
{ "os": "ubuntu-latest", "toolchain": "x86_64-unknown-linux-gnu", "name": "Linux GNU" },
|
|
169
|
+
{ "os": "macOS-latest", "toolchain": "aarch64-apple-darwin", "name": "macOS" },
|
|
170
|
+
{ "os": "windows-latest", "toolchain": "x86_64-pc-windows-msvc", "name": "Windows MSVC" },
|
|
171
|
+
{ "os": "windows-latest", "toolchain": "x86_64-pc-windows-gnu", "name": "Windows GNU" }
|
|
172
|
+
]
|
|
173
|
+
channel: ["stable", "beta", "nightly"]
|
|
174
|
+
|
|
175
|
+
steps:
|
|
176
|
+
- uses: actions/checkout@v4
|
|
177
|
+
- uses: dtolnay/rust-toolchain@master
|
|
178
|
+
with:
|
|
179
|
+
toolchain: ${{ format('{0}-{1}', matrix.channel, matrix.target.toolchain) }}
|
|
180
|
+
# Test b3sum.
|
|
181
|
+
- name: test b3sum
|
|
182
|
+
run: cargo test
|
|
183
|
+
working-directory: ./b3sum
|
|
184
|
+
- name: test b3sum --no-default-features
|
|
185
|
+
run: cargo test --no-default-features
|
|
186
|
+
working-directory: ./b3sum
|
|
187
|
+
|
|
188
|
+
cross_tests:
|
|
189
|
+
name: cross ${{ matrix.arch }}
|
|
190
|
+
runs-on: ubuntu-latest
|
|
191
|
+
strategy:
|
|
192
|
+
fail-fast: false
|
|
193
|
+
matrix:
|
|
194
|
+
arch:
|
|
195
|
+
- i586-unknown-linux-musl
|
|
196
|
+
- i686-unknown-linux-musl
|
|
197
|
+
- armv7-unknown-linux-gnueabihf
|
|
198
|
+
- aarch64-unknown-linux-gnu
|
|
199
|
+
# Big-endian targets. See https://twitter.com/burntsushi5/status/1695483429997945092.
|
|
200
|
+
- powerpc64-unknown-linux-gnu
|
|
201
|
+
- s390x-unknown-linux-gnu
|
|
202
|
+
|
|
203
|
+
steps:
|
|
204
|
+
- uses: actions/checkout@v4
|
|
205
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
206
|
+
- run: cargo install cross
|
|
207
|
+
# Test the portable implementation on everything.
|
|
208
|
+
- run: cross test --target ${{ matrix.arch }}
|
|
209
|
+
# Test building for ancient i386 processors without guaranteed SSE2 support.
|
|
210
|
+
- run: cross rustc --target ${{ matrix.arch }} -- -C target-cpu=i386
|
|
211
|
+
if: startsWith(matrix.arch, 'i586-') || startsWith(matrix.arch, 'i686-')
|
|
212
|
+
# Test the NEON implementation on ARM targets.
|
|
213
|
+
- run: cross test --target ${{ matrix.arch }} --features=neon
|
|
214
|
+
if: startsWith(matrix.arch, 'armv7-') || startsWith(matrix.arch, 'aarch64-')
|
|
215
|
+
# NEON is enabled by default on aarch64, disabling it through the no_neon feature.
|
|
216
|
+
- run: cross test --target ${{ matrix.arch }} --features=no_neon
|
|
217
|
+
if: startsWith(matrix.arch, 'aarch64-')
|
|
218
|
+
# Test vectors. Note that this uses a hacky script due to path dependency limitations.
|
|
219
|
+
- run: ./test_vectors/cross_test.sh --target ${{ matrix.arch }}
|
|
220
|
+
# C code. Same issue with the hacky script.
|
|
221
|
+
- run: ./c/blake3_c_rust_bindings/cross_test.sh --target ${{ matrix.arch }}
|
|
222
|
+
- run: ./c/blake3_c_rust_bindings/cross_test.sh --target ${{ matrix.arch }} --features=neon
|
|
223
|
+
if: startsWith(matrix.arch, 'armv7-') || startsWith(matrix.arch, 'aarch64-')
|
|
224
|
+
|
|
225
|
+
wasm_tests:
|
|
226
|
+
name: WASM tests
|
|
227
|
+
runs-on: ubuntu-latest
|
|
228
|
+
steps:
|
|
229
|
+
- uses: actions/checkout@v4
|
|
230
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
231
|
+
with:
|
|
232
|
+
targets: wasm32-wasip1
|
|
233
|
+
- name: install Wasmtime
|
|
234
|
+
run: |
|
|
235
|
+
curl https://wasmtime.dev/install.sh -sSf | bash
|
|
236
|
+
echo PATH: $PATH
|
|
237
|
+
mkdir -p ~/.local/bin
|
|
238
|
+
ln -s ~/.wasmtime/bin/wasmtime ~/.local/bin/wasmtime
|
|
239
|
+
- run: cargo test --target wasm32-wasip1
|
|
240
|
+
- run: cargo test --target wasm32-wasip1 --no-default-features
|
|
241
|
+
- run: cargo test --target wasm32-wasip1 --features wasm32_simd
|
|
242
|
+
- run: cargo test --target wasm32-wasip1 --no-default-features --features wasm32_simd
|
|
243
|
+
- run: cargo test --target wasm32-wasip1 --benches --features=wasm32_simd
|
|
244
|
+
env:
|
|
245
|
+
RUSTC_BOOTSTRAP: 1
|
|
246
|
+
- name: test vectors w/o SIMD
|
|
247
|
+
run: cargo test --target wasm32-wasip1
|
|
248
|
+
working-directory: ./test_vectors
|
|
249
|
+
- name: test vectors w/ SIMD
|
|
250
|
+
run: cargo test --target wasm32-wasip1 --features wasm32_simd
|
|
251
|
+
working-directory: ./test_vectors
|
|
252
|
+
|
|
253
|
+
cargo_xwin_test:
|
|
254
|
+
name: cargo xwin test
|
|
255
|
+
runs-on: ubuntu-latest
|
|
256
|
+
steps:
|
|
257
|
+
- uses: actions/checkout@v4
|
|
258
|
+
- run: docker run -v $(pwd):/io -w /io messense/cargo-xwin cargo xwin test --target x86_64-pc-windows-msvc --features=mmap,rayon,traits-preview,serde,zeroize
|
|
259
|
+
|
|
260
|
+
# Currently only on x86.
|
|
261
|
+
cmake_c_tests:
|
|
262
|
+
name: CMake C tests SIMD=${{ matrix.simd }} TBB=${{ matrix.use_tbb }}
|
|
263
|
+
runs-on: ubuntu-latest
|
|
264
|
+
strategy:
|
|
265
|
+
fail-fast: false
|
|
266
|
+
matrix:
|
|
267
|
+
use_tbb: ["OFF", "ON"]
|
|
268
|
+
simd: ["x86-intrinsics", "amd64-asm"]
|
|
269
|
+
steps:
|
|
270
|
+
- uses: actions/checkout@v4
|
|
271
|
+
- run: |
|
|
272
|
+
sudo apt-get update
|
|
273
|
+
sudo apt-get install ninja-build libtbb-dev libtbb12
|
|
274
|
+
# Test the intrinsics-based and assembly-based implementations.
|
|
275
|
+
- run: |
|
|
276
|
+
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON "-DBLAKE3_SIMD_TYPE=${{ matrix.simd }}"
|
|
277
|
+
cmake --build c/build --target test
|
|
278
|
+
cat c/build/Testing/Temporary/LastTest.log
|
|
279
|
+
- run: |
|
|
280
|
+
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON "-DBLAKE3_SIMD_TYPE=${{ matrix.simd }}" -DBLAKE3_NO_SSE2=1
|
|
281
|
+
cmake --build c/build --target test
|
|
282
|
+
cat c/build/Testing/Temporary/LastTest.log
|
|
283
|
+
- run: |
|
|
284
|
+
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON "-DBLAKE3_SIMD_TYPE=${{ matrix.simd }}" -DBLAKE3_NO_SSE2=1 -DBLAKE3_NO_SSE41=1
|
|
285
|
+
cmake --build c/build --target test
|
|
286
|
+
cat c/build/Testing/Temporary/LastTest.log
|
|
287
|
+
- run: |
|
|
288
|
+
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON "-DBLAKE3_SIMD_TYPE=${{ matrix.simd }}" "-DBLAKE3_NO_SSE2=1" "-DBLAKE3_NO_SSE41=1" "-DBLAKE3_NO_AVX2=1"
|
|
289
|
+
cmake --build c/build --target test
|
|
290
|
+
cat c/build/Testing/Temporary/LastTest.log
|
|
291
|
+
- run: |
|
|
292
|
+
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON "-DBLAKE3_SIMD_TYPE=${{ matrix.simd }}" "-DBLAKE3_NO_SSE2=1" "-DBLAKE3_NO_SSE41=1" "-DBLAKE3_NO_AVX2=1" "-DBLAKE3_NO_AVX512=1"
|
|
293
|
+
cmake --build c/build --target test
|
|
294
|
+
cat c/build/Testing/Temporary/LastTest.log
|
|
295
|
+
# Test with TBB disabled/enabled.
|
|
296
|
+
- run: |
|
|
297
|
+
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON "-DBLAKE3_USE_TBB=${{ matrix.use_tbb }}"
|
|
298
|
+
cmake --build c/build --target test
|
|
299
|
+
cat c/build/Testing/Temporary/LastTest.log
|
|
300
|
+
# Build the example with TBB disabled/enabled.
|
|
301
|
+
- run: |
|
|
302
|
+
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON -DBLAKE3_EXAMPLES=ON "-DBLAKE3_USE_TBB=${{ matrix.use_tbb }}"
|
|
303
|
+
cmake --build c/build --target blake3-example
|
|
304
|
+
|
|
305
|
+
# Currently only on x86.
|
|
306
|
+
pkg_config_c_tests:
|
|
307
|
+
name: pkg-config C tests TBB=${{ matrix.use_tbb }} BUILD_SHARED_LIBS=${{ matrix.shared_libs }} STDLIB=${{ matrix.stdlib }}
|
|
308
|
+
runs-on: ubuntu-latest
|
|
309
|
+
strategy:
|
|
310
|
+
fail-fast: false
|
|
311
|
+
matrix:
|
|
312
|
+
use_tbb: ["OFF", "ON"]
|
|
313
|
+
shared_libs: ["OFF", "ON"]
|
|
314
|
+
stdlib: ["libc++", "libstdc++"]
|
|
315
|
+
steps:
|
|
316
|
+
- uses: actions/checkout@v4
|
|
317
|
+
- name: update packages
|
|
318
|
+
run: |
|
|
319
|
+
sudo apt-get update
|
|
320
|
+
sudo apt-get install ninja-build libtbb-dev libtbb12
|
|
321
|
+
${{ matrix.stdlib != 'libc++' || 'sudo apt-get install libc++-dev libc++abi-dev' }}
|
|
322
|
+
- name: configure cmake
|
|
323
|
+
run: |
|
|
324
|
+
export CXXFLAGS=${{ matrix.stdlib == 'libc++' && '-stdlib=libc++' || '' }}
|
|
325
|
+
export CC=${{ matrix.stdlib == 'libc++' && 'clang' || 'gcc' }}
|
|
326
|
+
export CXX=${{ matrix.stdlib == 'libc++' && 'clang++' || 'g++' }}
|
|
327
|
+
cmake --fresh -S c -B c/build -G Ninja -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/target "-DBLAKE3_USE_TBB=${{ matrix.use_tbb }}" "-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }}" -DCMAKE_VERBOSE_MAKEFILE=1
|
|
328
|
+
- run: cmake --build c/build --target install
|
|
329
|
+
- run: mkdir -p ${{ github.workspace }}/target/bin
|
|
330
|
+
- run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/target/lib/pkgconfig" >> $GITHUB_ENV
|
|
331
|
+
- run: gcc -O3 -o ${{ github.workspace }}/target/bin/blake3-example c/example.c $(pkg-config --cflags --libs libblake3)
|
|
332
|
+
- if: matrix.use_tbb == 'ON'
|
|
333
|
+
run: gcc -O3 -o ${{ github.workspace }}/target/bin/blake3-example-tbb c/example_tbb.c $(pkg-config --cflags --libs libblake3)
|
|
334
|
+
|
|
335
|
+
# Note that this jobs builds AArch64 binaries from an x86_64 host.
|
|
336
|
+
build_apple_silicon:
|
|
337
|
+
name: build for Apple Silicon
|
|
338
|
+
runs-on: macOS-latest
|
|
339
|
+
strategy:
|
|
340
|
+
fail-fast: false
|
|
341
|
+
steps:
|
|
342
|
+
- uses: actions/checkout@v4
|
|
343
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
344
|
+
with:
|
|
345
|
+
targets: aarch64-apple-darwin
|
|
346
|
+
- name: build blake3
|
|
347
|
+
run: cargo build --target aarch64-apple-darwin
|
|
348
|
+
- name: build b3sum
|
|
349
|
+
run: cargo build --target aarch64-apple-darwin
|
|
350
|
+
working-directory: ./b3sum
|
|
351
|
+
|
|
352
|
+
build_tinycc:
|
|
353
|
+
name: build with the Tiny C Compiler
|
|
354
|
+
runs-on: ubuntu-latest
|
|
355
|
+
steps:
|
|
356
|
+
- uses: actions/checkout@v4
|
|
357
|
+
- name: install TCC
|
|
358
|
+
run: sudo apt-get install -y tcc
|
|
359
|
+
- name: compile
|
|
360
|
+
run: >
|
|
361
|
+
tcc -shared -O3 -o libblake3.so \
|
|
362
|
+
-DBLAKE3_NO_SSE2 -DBLAKE3_NO_SSE41 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_AVX512 \
|
|
363
|
+
blake3.c blake3_dispatch.c blake3_portable.c
|
|
364
|
+
working-directory: ./c
|
|
365
|
+
|
|
366
|
+
# See https://github.com/BLAKE3-team/BLAKE3/issues/271 for why we test this.
|
|
367
|
+
# Note that this isn't guaranteed to execute on an AVX-512-supporting server,
|
|
368
|
+
# but hopefully at least some of the time it will.
|
|
369
|
+
gcc54:
|
|
370
|
+
name: "compile and test with GCC 5.4"
|
|
371
|
+
runs-on: ubuntu-latest
|
|
372
|
+
steps:
|
|
373
|
+
- uses: actions/checkout@v4
|
|
374
|
+
- uses: addnab/docker-run-action@v3
|
|
375
|
+
with:
|
|
376
|
+
image: gcc:5.4
|
|
377
|
+
options: -v ${{ github.workspace }}:/work
|
|
378
|
+
run: |
|
|
379
|
+
cat /proc/cpuinfo
|
|
380
|
+
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
|
|
381
|
+
cd /work
|
|
382
|
+
~/.cargo/bin/cargo test --features prefer_intrinsics
|
|
383
|
+
|
|
384
|
+
# CMake build test (Library only).
|
|
385
|
+
cmake_current_build:
|
|
386
|
+
name: CMake ${{ matrix.os }} CC=${{ matrix.toolchain.cc }} CXX=${{ matrix.toolchain.cxx }} TBB=${{ matrix.use_tbb }}
|
|
387
|
+
runs-on: ${{ matrix.os }}
|
|
388
|
+
strategy:
|
|
389
|
+
fail-fast: false
|
|
390
|
+
matrix:
|
|
391
|
+
cmakeVersion: [latest]
|
|
392
|
+
ninjaVersion: [latest]
|
|
393
|
+
os: [ubuntu-latest, macOS-latest, windows-latest]
|
|
394
|
+
toolchain: [
|
|
395
|
+
{ cc: cl, cxx: cl },
|
|
396
|
+
{ cc: clang, cxx: clang++ },
|
|
397
|
+
{ cc: clang-cl, cxx: clang-cl },
|
|
398
|
+
{ cc: gcc, cxx: g++ },
|
|
399
|
+
]
|
|
400
|
+
use_tbb: [OFF, ON]
|
|
401
|
+
exclude:
|
|
402
|
+
- os: macOS-latest
|
|
403
|
+
toolchain: { cc: cl, cxx: cl }
|
|
404
|
+
- os: macOS-latest
|
|
405
|
+
toolchain: { cc: clang-cl, cxx: clang-cl }
|
|
406
|
+
- os: ubuntu-latest
|
|
407
|
+
toolchain: { cc: cl, cxx: cl }
|
|
408
|
+
- os: ubuntu-latest
|
|
409
|
+
toolchain: { cc: clang-cl, cxx: clang-cl }
|
|
410
|
+
- os: windows-latest
|
|
411
|
+
toolchain: { cc: clang, cxx: clang++ }
|
|
412
|
+
use_tbb: ON
|
|
413
|
+
- os: windows-latest
|
|
414
|
+
toolchain: { cc: gcc, cxx: g++ }
|
|
415
|
+
use_tbb: ON
|
|
416
|
+
steps:
|
|
417
|
+
- uses: actions/checkout@v4
|
|
418
|
+
- uses: lukka/get-cmake@5f6e04f5267c8133f1273bf2103583fc72c46b17
|
|
419
|
+
with:
|
|
420
|
+
cmakeVersion: ${{ matrix.cmakeVersion }}
|
|
421
|
+
ninjaVersion: ${{ matrix.ninjaVersion }}
|
|
422
|
+
- if: matrix.os == 'macOS-latest'
|
|
423
|
+
name: Install dependencies on macOS
|
|
424
|
+
run: |
|
|
425
|
+
brew update
|
|
426
|
+
brew install tbb
|
|
427
|
+
- if: matrix.os == 'ubuntu-latest'
|
|
428
|
+
name: Install dependencies on Linux
|
|
429
|
+
run: |
|
|
430
|
+
sudo apt-get update
|
|
431
|
+
sudo apt-get install libtbb-dev libtbb12
|
|
432
|
+
- name: CMake generation, build, install
|
|
433
|
+
run: |
|
|
434
|
+
${{ matrix.os != 'windows-latest' || '& "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/Tools/Launch-VsDevShell.ps1" -Arch amd64 -SkipAutomaticLocation' }}
|
|
435
|
+
cmake -S c -B c/build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/target -DCMAKE_C_COMPILER=${{ matrix.toolchain.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.toolchain.cxx }} -DBLAKE3_USE_TBB=${{ matrix.use_tbb }} -DBLAKE3_FETCH_TBB=${{ matrix.os == 'windows-latest' && 'YES' || 'NO' }} -DBLAKE3_EXAMPLES=ON
|
|
436
|
+
cmake --build c/build --target install
|
|
437
|
+
|
|
438
|
+
cmake_3-9_build:
|
|
439
|
+
name: CMake 3.9.6 ubuntu-latest
|
|
440
|
+
runs-on: ubuntu-latest
|
|
441
|
+
steps:
|
|
442
|
+
- uses: actions/checkout@v4
|
|
443
|
+
- uses: lukka/get-cmake@5f6e04f5267c8133f1273bf2103583fc72c46b17
|
|
444
|
+
with:
|
|
445
|
+
cmakeVersion: 3.9.6
|
|
446
|
+
- name: Create build directory
|
|
447
|
+
run: mkdir c/build
|
|
448
|
+
- name: CMake generation
|
|
449
|
+
run: cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/target
|
|
450
|
+
working-directory: c/build
|
|
451
|
+
- name: CMake build / install
|
|
452
|
+
run: make install
|
|
453
|
+
working-directory: c/build
|
|
454
|
+
|
|
455
|
+
miri_smoketest:
|
|
456
|
+
name: Miri smoketest
|
|
457
|
+
runs-on: ubuntu-latest
|
|
458
|
+
steps:
|
|
459
|
+
- uses: actions/checkout@v4
|
|
460
|
+
- uses: dtolnay/rust-toolchain@nightly
|
|
461
|
+
with:
|
|
462
|
+
components: miri
|
|
463
|
+
# Currently the test search "miri" only matches "test_miri_smoketest", but
|
|
464
|
+
# we might add more. If this accidentally picks up anything incompatible or
|
|
465
|
+
# slow, we can narrow it.
|
|
466
|
+
- run: cargo miri test miri
|
|
467
|
+
|
|
468
|
+
tbb_rust_bindings_tests:
|
|
469
|
+
name: TBB test bindings ${{ matrix.os }}
|
|
470
|
+
runs-on: ${{ matrix.os }}
|
|
471
|
+
strategy:
|
|
472
|
+
fail-fast: false
|
|
473
|
+
matrix:
|
|
474
|
+
os: ["ubuntu-latest", "macOS-latest"]
|
|
475
|
+
steps:
|
|
476
|
+
- uses: actions/checkout@v4
|
|
477
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
478
|
+
- name: install TBB
|
|
479
|
+
if: matrix.os == 'ubuntu-latest'
|
|
480
|
+
run: |
|
|
481
|
+
sudo apt-get update
|
|
482
|
+
sudo apt-get install libtbb-dev libtbb12
|
|
483
|
+
- name: install TBB
|
|
484
|
+
if: matrix.os == 'macOS-latest'
|
|
485
|
+
run: |
|
|
486
|
+
brew install tbb
|
|
487
|
+
echo "CXXFLAGS=-I$(brew --prefix)/include $CPPFLAGS" >> $GITHUB_ENV
|
|
488
|
+
echo "RUSTFLAGS=-L$(brew --prefix)/lib $RUSTFLAGS" >> $GITHUB_ENV
|
|
489
|
+
- name: cargo test C bindings with TBB
|
|
490
|
+
run: cargo test --features=tbb
|
|
491
|
+
working-directory: ./c/blake3_c_rust_bindings
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: publish_b3sum_binaries
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "*"
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
BLAKE3_CI: "1"
|
|
10
|
+
RUSTFLAGS: "-D warnings"
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
cargo_tests:
|
|
14
|
+
name: ${{ matrix.target.name }}
|
|
15
|
+
runs-on: ${{ matrix.target.os }}
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
target: [
|
|
20
|
+
{ "os": "ubuntu-latest", "rust-target": "x86_64-unknown-linux-musl", "name": "Linux" },
|
|
21
|
+
{ "os": "macOS-latest", "rust-target": "x86_64-apple-darwin", "name": "macOS" },
|
|
22
|
+
{ "os": "windows-latest", "rust-target": "x86_64-pc-windows-msvc", "name": "Windows" },
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- uses: actions/setup-python@v4
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.x"
|
|
30
|
+
- run: pip install PyGithub
|
|
31
|
+
- run: sudo apt-get install musl-tools
|
|
32
|
+
if: matrix.target.os == 'ubuntu-latest'
|
|
33
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
34
|
+
with:
|
|
35
|
+
targets: ${{ matrix.target.rust-target }}
|
|
36
|
+
- name: build b3sum
|
|
37
|
+
id: build_b3sum
|
|
38
|
+
run: python -u .github/workflows/build_b3sum.py ${{ matrix.target.rust-target }}
|
|
39
|
+
- name: upload release asset
|
|
40
|
+
env:
|
|
41
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
42
|
+
GITHUB_TAG: ${{ github.ref }}
|
|
43
|
+
run: python -u .github/workflows/upload_github_release_asset.py ${{ steps.build_b3sum.outputs.bin_path }}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#! /usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
import github
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
import time
|
|
7
|
+
|
|
8
|
+
RETRIES = 10
|
|
9
|
+
|
|
10
|
+
g = github.Github(os.environ["GITHUB_TOKEN"])
|
|
11
|
+
tag_name = os.environ["GITHUB_TAG"]
|
|
12
|
+
tag_prefix = "refs/tags/"
|
|
13
|
+
if tag_name.startswith(tag_prefix):
|
|
14
|
+
tag_name = tag_name[len(tag_prefix) :]
|
|
15
|
+
assert len(sys.argv) == 2
|
|
16
|
+
asset_path = sys.argv[1]
|
|
17
|
+
asset_name = os.path.basename(asset_path)
|
|
18
|
+
|
|
19
|
+
repo = g.get_repo(os.environ["GITHUB_REPOSITORY"])
|
|
20
|
+
|
|
21
|
+
tags = list(repo.get_tags())
|
|
22
|
+
|
|
23
|
+
for tag in tags:
|
|
24
|
+
if tag.name == tag_name:
|
|
25
|
+
break
|
|
26
|
+
else:
|
|
27
|
+
raise RuntimeError("no tag named " + repr(tag_name))
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
print("Creating GitHub release for tag " + repr(tag_name) + "...")
|
|
31
|
+
repo.create_git_release(tag_name, tag_name, tag.commit.commit.message)
|
|
32
|
+
except github.GithubException as github_error:
|
|
33
|
+
if github_error.data["errors"][0]["code"] == "already_exists":
|
|
34
|
+
print("Release for tag " + repr(tag_name) + " already exists.")
|
|
35
|
+
else:
|
|
36
|
+
raise
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def get_release():
|
|
40
|
+
for i in range(RETRIES):
|
|
41
|
+
releases = list(repo.get_releases())
|
|
42
|
+
for release in releases:
|
|
43
|
+
if release.tag_name == tag_name:
|
|
44
|
+
return release
|
|
45
|
+
print(f"Release for tag {repr(tag_name)} not found. Retrying...")
|
|
46
|
+
time.sleep(1)
|
|
47
|
+
raise RuntimeError("no release for tag " + repr(tag_name))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
release = get_release()
|
|
51
|
+
|
|
52
|
+
print("Uploading " + repr(asset_path) + "...")
|
|
53
|
+
for i in range(RETRIES):
|
|
54
|
+
try:
|
|
55
|
+
print("Upload attempt #{} of {}...".format(i + 1, RETRIES))
|
|
56
|
+
release.upload_asset(asset_path)
|
|
57
|
+
break
|
|
58
|
+
except github.GithubException as github_error:
|
|
59
|
+
# Unfortunately the asset upload API is flaky. Even worse, it often
|
|
60
|
+
# partially succeeds, returning an error to the caller but leaving the
|
|
61
|
+
# release in a state where subsequent uploads of the same asset will
|
|
62
|
+
# fail with an "already_exists" error. (Though the asset is not visible
|
|
63
|
+
# on github.com, so we can't just declare victory and move on.) If we
|
|
64
|
+
# detect this case, explicitly delete the asset and continue retrying.
|
|
65
|
+
print(github_error)
|
|
66
|
+
for asset in release.get_assets():
|
|
67
|
+
if asset.name == asset_name:
|
|
68
|
+
print("Found uploaded asset after failure. Deleting...")
|
|
69
|
+
asset.delete_asset()
|
|
70
|
+
else:
|
|
71
|
+
raise RuntimeError("All upload attempts failed.")
|
|
72
|
+
|
|
73
|
+
print("Success!")
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
We welcome and encourage third-party contributions to BLAKE3, be it reports of issues encountered while using the software or proposals of patches.
|
|
4
|
+
|
|
5
|
+
## Bug reports
|
|
6
|
+
|
|
7
|
+
Bugs and other problems should be reported on [GitHub Issues](https://github.com/BLAKE3/BLAKE3/issues).
|
|
8
|
+
|
|
9
|
+
If you report a bug, please:
|
|
10
|
+
|
|
11
|
+
* Check that it's not already reported in the [GitHub Issues](https://github.com/BLAKE3/BLAKE3/issues).
|
|
12
|
+
* Provide information to help us diagnose and ideally reproduce the bug.
|
|
13
|
+
|
|
14
|
+
## Patches
|
|
15
|
+
|
|
16
|
+
We encourage you to fix a bug via a [GitHub Pull request](https://github.com/BLAKE3/BLAKE3/pulls), preferably after creating a related issue and referring it in the PR.
|
|
17
|
+
|
|
18
|
+
If you contribute code and submit a patch, please note the following:
|
|
19
|
+
|
|
20
|
+
* We use Rust's stable branch for developing BLAKE3.
|
|
21
|
+
* Pull requests should target the `master` branch.
|
|
22
|
+
* Try to follow the established Rust [style guidelines](https://doc.rust-lang.org/1.0.0/style/).
|
|
23
|
+
|
|
24
|
+
Also please make sure to create new unit tests covering your code additions. You can execute the tests by running:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cargo test
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
All third-party contributions will be recognized in the list of contributors.
|
|
31
|
+
|