aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
AgeCommit message (Collapse)Author
2025-11-24Add `Hash::as_slice()` for convenient serialization to bytesJosh Triplett
`Hash::as_bytes()` returns the hash as an array of bytes. However, sometimes it's useful to have the hash as a slice of bytes instead, such as for serialization via an API that takes `&[u8]`. While `.as_bytes().as_slice()` works for this, it'd be more convenient to have a direct `.as_slice()` on hashes.
2025-06-04remove a commaJack O'Connor
2025-04-24update docs for the "std" featureJack O'Connor
Previously "std" enabled runtime CPU feature detection on x86, but as of https://github.com/BLAKE3-team/BLAKE3/pull/469 that's always on.
2025-04-16clarify a commentJack O'Connor
2025-03-30add the `hazmat` module and deprecate the undocumented `guts` moduleJack O'Connor
https://github.com/BLAKE3-team/BLAKE3/pull/458
2025-03-18mention the "wasm32_simd" Cargo feature in the crate docsJack O'Connor
2025-03-16Wasm32 SIMD implementationIvan Boldyrev
This code is based on rust_sse2.rs of the same distribution, and is subject to further improvements. Some comments are left intact even if their applicability is questioned. SIMD implementation is gated by `wasm32-simd` feature, portable version is used otherwise. Performance measurements with a primitive benchmark with ~16Kb of data: | M1 native | 11,610 ns | | M1 WASM SIMD | 13,355 ns | | M1 WASM | 22,037 ns | | x64 native | 6,713 ns | | x64 WASM SIMD | 11,985 ns | | x64 WASM | 25,978 ns | wasmtime v12.0.1 was used on both platforms. Closes #187.
2025-02-17Add `Hash::from_slice` to handle conversion from `&[u8]` bytesJosh Triplett
This is a convenience method, to avoid having to first call `<[u8; 32]>::try_from(slice)?`.
2024-08-27Remove Miri equality workaround functionAaron Feickert
2024-08-22put equivalent Hasher examples in the hash/keyed_hash/derive_key docsJack O'Connor
This was a good suggestion by @dhardy: https://github.com/rust-random/rand/issues/989#issuecomment-2303969094
2024-08-18small cleanup in fill_one_blockJack O'Connor
2024-08-15integrate xof_many with the Rust implementation and with Rust and C testsJack O'Connor
2024-07-17Manually implement `Zeroize`Gard Kylling
Removes dependence on proc-macros when enabling the zeroize feature.
2024-07-14Revert "serialize Hash with serde_bytes"Jack O'Connor
This mostly reverts commits 8416b1658c2690dc6351bdc7e0975b0d5f1a5282 and dd0afd640ad97b5ebcf887107162009a23ffdca0. Changing the serialization of Hash can only be backwards-compatible in self-describing formats like CBOR. In non-self-describing formats like bincode, the deserializer has to know in advance which serialization format was used. Fixes https://github.com/BLAKE3-team/BLAKE3/issues/414. Reopens https://github.com/BLAKE3-team/BLAKE3/issues/412.
2024-07-09serialize Hash with serde_bytesJack O'Connor
Closes #412.
2024-07-03chore: fix some commentswangcundashang
Signed-off-by: wangcundashang <[email protected]>
2024-03-09avoid using constant_time_eq under MiriJack O'Connor
2023-09-19add a test for the new serde featureJack O'Connor
2023-09-19Add serde support for Hash behind optional featureRalph Minderhoud
Added a new cargo feature `serde` that when enabled will derive `serde::Serialize` and `serde::Deserialize` for the `blake3::Hash` struct.
2023-09-19minor cleanup in Hasher docsJack O'Connor
2023-09-16make update_reader/mmap/mmap_rayon return selfJack O'Connor
This makes them consistent with how the existing update() and update_rayon() methods work, with the difference being that it's it's io::Result<&mut Self> instead of just &mut Self.
2023-09-16replace the new file module with inherent methods on HasherJack O'Connor
New methods: - update_reader - update_mmap - update_mmap_rayon These are more discoverable, more convenient, and safer. There are two problems I want to avoid by taking a `Path` instead of a `File`. First, exposing `Mmap` objects to the caller is fundamentally unsafe, and making `maybe_mmap_file` private avoids that issue. Second, taking a `File` raises questions about whether memory mapped reads should behave like regular file reads. (Should they respect the current seek position? Should they update the seek position?) Taking a `Path` from the caller and opening the `File` internally avoids these questions.
2023-09-16move file operations from b3sum to blake3Banyc
2023-09-16document the `zeroize` Cargo featureJack O'Connor
As part of this change, I don't think we need the `zeroize_crate` workaround anymore if we use the relateively new `dep:` syntax in Cargo.toml.
2023-07-16Implement Zeroize on exported typesElichai Turkel
2023-06-27Fix typo exendable -> extendable1f604
2023-05-01small doc tweakJack O'Connor
2023-05-01add `from_bytes` for conversions from `[u8; 32]`Eduardo Leegwater Simões
The function is `const`, so it is fundamentally different from the `From` trait implementation by allowing compile-time instantiation of a `Hash`.
2023-05-01make `Hash::as_bytes` constEduardo Leegwater Simões
2022-07-28Fix doc typoRicardo Fernández Serrata
2022-06-07simplify a line in the docs example codeJack O'Connor
The same change was previously made in README.md.
2022-03-04add "(if any)" regarding keying in the security notesJack O'Connor
2022-03-03simplify a bit moreJack O'Connor
2022-03-02simplify the security notes, avoid referring to entropyJack O'Connor
2022-03-02document the extended output security issue found by Aldo GunsingJack O'Connor
https://eprint.iacr.org/2022/283
2021-12-30a few more comment tweaksJack O'Connor
2021-12-30Update digest crate to 0.10 for traits-preview featureMatthias Schiffer
Adjust to the following changes that happened in digest: - The crypto-mac crate has been merged into digest (with "mac" feature enabled) - Various traits have been split up - The Digest and Mac traits now share their update/finalize/reset implementations - The BlockInput trait was dropped without replacement apparently (as long as the low-level core API is not used)
2021-11-04add Hasher::countJack O'Connor
2021-10-29remove an incorrect commentJack O'Connor
2021-10-23update NEON docs in lib.rsJack O'Connor
2021-10-07Implement better target detection for NEONrsdy
2021-09-10clarify that OutputReader::position is equivalent to Seek::stream_positionJack O'Connor
2021-09-10link to the paper in the derive_key docsJack O'Connor
2021-07-25update README examplesJack O'Connor
2021-05-18upgrade to arrayvec 0.7.0Jack O'Connor
This version uses const generics, which bumps our minimum supported compiler version to 1.51.
2021-05-18explicitly document the properties of short outputsJack O'Connor
Suggested by @joshtriplett at: https://github.com/BLAKE3-team/BLAKE3/issues/168#issuecomment-829609667
2021-03-28more cleaup of undocumented APIJack O'Connor
2021-03-21implement Display for HashJack O'Connor
2021-03-21get rid of the standalone "*_rayon" functionsJack O'Connor
These clutter the toplevel API, and their prominence might lead callers to prefer them as a first resort, which probably isn't a good idea. Restricting multithreading to `Hasher::update_rayon` feels better, similar to what we've done with `Hasher::finalize_xof`. (But I think `update_rayon` is still an improvement over the trait-based interface that it replaced.)
2021-03-21gate digest and crypto-mac implementations behind "traits-preview"Jack O'Connor
This approach was suggested by @tarcieri at https://github.com/BLAKE3-team/BLAKE3/pull/157.