1
0
Fork 0
mirror of https://github.com/BLAKE3-team/BLAKE3 synced 2024-04-25 01:55:09 +02:00
Commit Graph

25 Commits

Author SHA1 Message Date
Jack O'Connor 02dec6e9a6 fix a build break in the blake3_c tests 2023-09-10 14:04:57 -07:00
Jack O'Connor d6265dafc9 update dev-dependencies 2023-09-10 13:40:12 -07:00
Joel Rosdahl 2dd4e57f68 Fix typos 2023-05-23 14:39:27 -07:00
Jack O'Connor a9750c7fec upgrade all Cargo.toml files to edition=2021
The MSRV is already 1.60, so this doesn't affect much. The only impact
to other code is that we no longer need to explicitly import TryInto.
2023-03-25 16:36:37 -07:00
Jack O'Connor 5dad698d3f test multiple initial counter values for hash_many
I'm adding the i32::MAX test case here because I personally screwed it
up while I was working on
https://github.com/BLAKE3-team/BLAKE3/issues/271. The correct
implementation of the carry bit is the ANDNOT of old high bit (1) and
the new high bit (0). Using XOR instead of ANDNOT gives the correct
answer in the overflow case, but it also reports an incorrect "extra"
overflow when the high bit goes from 0 to 1.
2022-11-22 23:31:29 -08:00
Jack O'Connor 7d8c005071 add blake3_hasher_reset to the C API 2022-01-07 15:51:35 -05:00
rsdy 6b9cbe5e23 Match the C binding's target arch detection with the root crate's 2021-10-11 20:45:01 +01:00
Jack O'Connor 037de38bfe upgrade to arrayvec 0.7.0
This version uses const generics, which bumps our minimum supported
compiler version to 1.51.
2021-05-18 12:28:29 -04:00
Jack O'Connor 3d212291b9 add cross_test.sh for the C bindings
This will let us add big endian testing to CI for our C code. (We were
already doing it for our Rust code.)

This is adapted from test_vectors/cross_test.sh. It works around the
limitation that the `cross` tool can't reach parent directories. It's an
unfortunate hack, but at least it's only for testing. It might've been
less hacky to use symlinks for this somehow, but I worry that would
break things on Windows, and I don't want to have to add workarounds for
my workarounds.
2020-09-29 16:48:18 -04:00
Jack O'Connor 3817999f17 fix the short_test_cases loop in the C bindings tests 2020-09-29 11:06:32 -04:00
Jack O'Connor 5bdfd07666 update the blake3_c_rust_bindings test cases also 2020-09-29 10:59:56 -04:00
Jack O'Connor ac1da75bb9 add a test for blake3_hasher_init_derive_key_raw 2020-09-10 16:52:14 -04:00
Samuel Neves 8610ebda6a add sse2 tests and benchmarks 2020-08-31 19:12:01 +01:00
Matthew Krupcale d91f20dd29 Start SSE2 implementation based on SSE4.1 version
Wire up basic functions and features for SSE2 support using the SSE4.1 version
as a basis without implementing the SSE2 instructions yet.

 * Cargo.toml: add no_sse2 feature
 * benches/bench.rs: wire SSE2 benchmarks
 * build.rs: add SSE2 rust intrinsics and assembly builds
 * c/Makefile.testing: add SSE2 C and assembly targets
 * c/README.md: add SSE2 to C build instructions
 * c/blake3_c_rust_bindings/build.rs: add SSE2 C rust binding builds
 * c/blake3_c_rust_bindings/src/lib.rs: add SSE2 C rust bindings
 * c/blake3_dispatch.c: add SSE2 C dispatch
 * c/blake3_impl.h: add SSE2 C function prototypes
 * c/blake3_sse2.c: add SSE2 C intrinsic file starting with SSE4.1 version
 * c/blake3_sse2_x86-64_{unix.S,windows_gnu.S,windows_msvc.asm}: add SSE2
   assembly files starting with SSE4.1 version
 * src/ffi_sse2.rs: add rust implementation using SSE2 C rust bindings
 * src/lib.rs: add SSE2 rust intrinsics and SSE2 C rust binding rust SSE2 module
   configurations
 * src/platform.rs: add SSE2 rust platform detection and dispatch
 * src/rust_sse2.rs: add SSE2 rust intrinsic file starting with SSE4.1 version
 * tools/instruction_set_support/src/main.rs: add SSE2 feature detection
2020-08-24 00:54:46 -04:00
Jack O'Connor e06a0f255a refactor the Cargo feature set
The biggest change here is that assembly implementations are enabled by
default.

Added features:
- "pure" (Pure Rust, with no C or assembly implementations.)

Removed features:
- "c" (Now basically the default.)

Renamed features;
- "c_prefer_intrinsics" -> "prefer_intrinsics"
- "c_neon" -> "neon"

Unchanged:
- "rayon"
- "std" (Still the only feature on by default.)
2020-03-29 18:02:03 -04:00
Jack O'Connor a4ceef3932 add blake3_hasher_finalize_seek to the C API 2020-03-25 17:11:36 -04:00
Jack O'Connor 8d84cfc0af remove a mis-optimization that hurt performance for uneven updates
If the total number of chunks hashed so far is e.g. 1, and update() is
called with e.g. 8 more chunks, we can't compress all 8 together. We
have to break the input up, to make sure that that 1 lone chunk CV gets
merged with its proper sibling, and that in general the correct layout
of the tree is preserved. What we should do is hash 1-2-4-1 chunks of
input, using increasing powers of 2 (with some cleanup at the end). What
we were doing was 2-2-2-2 chunks. This was the result of a mistaken
optimization that got us stuck with an always-odd number of chunks so
far.

Fixes https://github.com/BLAKE3-team/BLAKE3/issues/69.
2020-02-25 11:40:37 -05:00
Jack O'Connor fcc14c8c1b more file renaming, use underscores more consistently 2020-02-12 18:41:41 -05:00
Erik Johansson 0281f1ae16 Rename assembly files (blake3-* -> blake3_*)
This gives the assembly files the same prefix as the intrinsics files which
simplifies building when the build system should pick between the assembly and
the intrinsics files.
2020-02-12 23:08:44 +01:00
Jack O'Connor b8a1d2d982 integrate assembly implementations into blake3_c_rust_bindings 2020-02-12 10:23:17 -05:00
Jack O'Connor 444a338b45 remove an obsolete remark about performance 2020-01-27 13:04:36 -05:00
Jack O'Connor 163f52245d port compress_subtree_to_parent_node from Rust to C
This recursive function performs parallel parent node hashing, which is
an important optimization.
2020-01-22 21:32:39 -05:00
Jack O'Connor 92d421dea1 add a larger test case
One thing I like to test is that, if I hack simd_degree to be higher
than MAX_SIMD_DEGREE, assertions fire. This requires a test case long
enough to exceed that number of chunks.
2020-01-22 21:19:47 -05:00
Jack O'Connor 28701d1585 add a README.md in c/blake3_c_rust_bindings 2020-01-16 18:29:20 -05:00
Jack O'Connor 84c26670bf add blake3_c_rust_bindings for testing and benchmarking 2020-01-16 16:09:42 -05:00