aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2021-02-28EXPERIMENTAL: change derive_key() to use const genericsderive_key_arrayJack O'Connor
2021-02-25Cargo.toml: upgrade all non API breaking dependenciesPaul Grandperrin
2021-02-04rename ParseError to HexError and update docsJack O'Connor
2021-02-04implement Error for ParseError, make it opaque, and support from_hex(&[u8])Jack O'Connor
2021-02-03merge "Adding from_hex and implementing FromStr for Hash"Jack O'Connor
https://github.com/BLAKE3-team/BLAKE3/pull/24
2020-09-29add more test cases at shorter input lengthsJack O'Connor
2020-09-10cargo fmtJack O'Connor
2020-08-31add the dynamic check for SSE2 supportJack O'Connor
It will be very rare that this actually executes, but we should include it for completeness.
2020-08-31fix a build break on x86 targets without guaranteed SSE2 supportJack O'Connor
This is quite hard to trigger, because SSE2 has been guaranteed for a long time. But you could trigger it this way: rustup target add i686-unknown-linux-musl RUSTFLAGS="-C target-cpu=i386" cargo build --target i686-unknown-linux-musl Note a relevant gotcha though: The `cross` tool will not forward environment variables like RUSTFLAGS to the container by default, so if you're testing with `cross` you'll need to use the `rustc` command to explicitly pass the flag, as I've done here in ci.yml. (Or you could create a `Cross.toml` file, but I don't want to commit one of those if I can avoid it.)
2020-08-31Merge pull request #110 from mkrupcale/sse2Samuel Neves
Add SSE2 implementations
2020-08-31Implement `fmt::Debug` using buildersNikolai Vazquez
This enables pretty printing via `{:#?}`. The normal style for `{:?}` is kept exactly the same.
2020-08-25Write _mm_blend_epi16 emulation without multiplicationMatthew Krupcale
Use _mm_and_si128 and _mm_cmpeq_epi16 rather than expensive multiplication _mm_mullo_epi16 with _mm_srai_epi16 that compiler may not be able to optimize.
2020-08-24Fix unreachable expression compiler warningMatthew Krupcale
SSE2 target_feature appears to always be present for x86_64.
2020-08-24SSE2 intrinsic: emulate _mm_blend_epi16 SSE4.1 intrinsic with SSE2 intrinsicsMatthew Krupcale
Use a constant mask to blend according to (mask & b) | ((~mask) & a). * src/rust_sse2.rs: emulate _mm_blend_epi16 using SSE2 intrinsics * c/blake3_sse2.c: Likewise.
2020-08-24Start SSE2 implementation based on SSE4.1 versionMatthew Krupcale
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-14the same hex example for rustdocsJack O'Connor
2020-06-26shrink a stack array that's twice as big as it needs to beJack O'Connor
It looks like I originally made this mistake when I was copying code from the baokeshed prototype (a274a9b0faa444dd842a0584483eae6e97dbf21e), and then it got replicated into the C implementation later.
2020-06-14a little bit of cleanup and more testingJack O'Connor
2020-06-14Replace std::io::copy with clone_from_sliceJustus K
2020-06-14Bump digest to 0.9.0 and crypto-mac to 0.8.0Justus K
2020-05-23fix another small mistake in the docsJack O'Connor
2020-04-11print the compiler version in CI, for help with debuggingJack O'Connor
2020-04-10unbreak neon benchmarksJack O'Connor
A helper function was incorrectly restricted to x86-only. CI doesn't currently cover this, because benchmarks are nightly-only, and it's kind of inconvenient to set RUSTC_BOOTSTRAP=1 through `cross` (which normally doesn't propagate env vars). But maybe we should start...
2020-04-01automatically fall back to the pure Rust buildJack O'Connor
There are two scenarios where compiling AVX-512 C or assembly code might not work: 1. There might not be a C compiler installed at all. Most commonly this is either in cross-compiling situations, or with the Windows GNU target. 2. The installed C compiler might not support e.g. -mavx512f, because it's too old. In both of these cases, print a relevant warning, and then automatically fall back to using the pure Rust intrinsics build. Note that this only affects x86 targets. Other targets always use pure Rust, unless the "neon" feature is enabled.
2020-03-29add testing-only flags to disable individual instruction setsJack O'Connor
This lets CI test a wider range of possible SIMD support settings.
2020-03-29refactor the Cargo feature setJack O'Connor
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-28print out instruction set support in CIJack O'Connor
2020-03-05add an example of parsing a Hash from a hex stringJack O'Connor
Suggested by @zaynetro: https://github.com/BLAKE3-team/BLAKE3/pull/24#issuecomment-594369061
2020-02-27some comment typosJack O'Connor
2020-02-25remove a mis-optimization that hurt performance for uneven updatesJack O'Connor
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-12add a performance note and a usage example for HasherJack O'Connor
2020-02-12document optional Cargo features on docs.rsJack O'Connor
2020-02-12integrate assembly implementations into the blake3 crateJack O'Connor
2020-02-12test a couple more reset() casesJack O'Connor
2020-02-11use a non-zero value for counter when testing hash_many with parentsJack O'Connor
We use a counter value that's very close to wrapping the lower word, when we're testing the hash_many chunks case. It turns out that this is a useful thing to do with parents too, even though parents 1) are teeechnically supposed to always use a counter of 0, and 2) aren't going to increment the counter at all. We caught a bug in the assembly implementations this way (where we accidentally did increment the counter, but only the higher word), because the equivalent test in rust_c_bindings uses this eccentric parents counter value.
2020-02-10avoid compiling avx512_detected() when the "c_avx512" feature is disabledJack O'Connor
https://github.com/rust-lang/rust/issues/68905 is currently causing nightly builds to fail, unless `--no-default-features` is used. This change means that the default build will succeed, and the failure will only happen when the "c_avx512" is enabled. The `b3sum` crate will still fail to build on nightly, because it enables that feature, but most callers should start succeeding on nightly.
2020-02-06Hasher::update_with_joinJack O'Connor
This is a new interface that allows the caller to provide a multi-threading implementation. It's defined in terms of a new `Join` trait, for which we provide two implementations, `SerialJoin` and `RayonJoin`. This lets the caller control when multi-threading is used, rather than the previous all-or-nothing design of the "rayon" feature. Although existing callers should keep working, this is a compatibility break, because callers who were relying on automatic multi-threading before will now be single-threaded. Thus the next release of this crate will need to be version 0.2. See https://github.com/BLAKE3-team/BLAKE3/issues/25 and https://github.com/BLAKE3-team/BLAKE3/issues/54.
2020-02-04re-export digest and crypto_macJack O'Connor
2020-02-03Inline wrapper methodsCesar Eduardo Barros
2020-02-03make the inherent reset() method return &mut selfJack O'Connor
2020-02-03implement crypto_mac::MacJack O'Connor
2020-02-02mention the digest traits in the docsJack O'Connor
2020-02-02implement traits from the digest crateJack O'Connor
2020-02-02add Hasher::resetJack O'Connor
Closes https://github.com/BLAKE3-team/BLAKE3/issues/41.
2020-01-22add a larger test caseJack O'Connor
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-21expand comments about lazy mergingJack O'Connor
2020-01-21stack size in the optimized impl should be MAX_DEPTH + 1Jack O'Connor
2020-01-20double the maximum incremental subtree sizeJack O'Connor
Because compress_subtree_to_parent_node effectively cuts its input in half, we can give it an input that's twice as big, without violating the CV stack invariant.
2020-01-19manually prefetch message blocksSamuel Neves
2020-01-18comment about parallelismJack O'Connor