commit_hash
stringlengths
40
40
author
stringlengths
1
57
date
timestamp[s]date
2010-07-26 04:45:09
2026-04-14 18:21:10
message
stringlengths
8
1.39M
diff
stringlengths
68
51.2k
files_changed
int64
1
136
insertions
int64
0
2.35k
deletions
int64
0
1.9k
e43a7d68bc5a708c5cede660c843eb613c7d0013
Jack O'Connor
2020-02-10T20:24:10
avoid compiling avx512_detected() when the "c_avx512" feature is disabled 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 en...
diff --git a/src/platform.rs b/src/platform.rs index abf9d30..b453a6e 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -252,6 +252,7 @@ impl Platform { // Note that AVX-512 is divided into multiple featuresets, and we use two of // them, F and VL. +#[cfg(feature = "c_avx512")] #[cfg(any(target_arch = "x86", t...
1
1
0
fc219f4f8d92f721d6444bb7420d42d88ee4b43c
Jack O'Connor
2020-02-03T16:35:50
Hasher::update_with_join 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 a...
diff --git a/Cargo.toml b/Cargo.toml index 3324d7f..4d8e7cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,10 @@ c_avx512 = [] c_neon = [] std = ["digest/std"] +[package.metadata.docs.rs] +# Document blake3::join::RayonJoin on docs.rs. +features = ["rayon"] + [dependencies] arrayref = "0.3.5" arrayvec = {...
6
377
50
24071db3463f29a6ad6173e3aea62b0f1497b5bc
Jack O'Connor
2020-02-04T15:02:46
re-export digest and crypto_mac
diff --git a/src/lib.rs b/src/lib.rs index 979b4dc..996a865 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,7 +58,7 @@ pub mod portable; #[doc(hidden)] pub mod sse41; -mod traits; +pub mod traits; use arrayref::{array_mut_ref, array_ref}; use arrayvec::{ArrayString, ArrayVec}; diff --git a/src/traits.rs b/src/t...
2
7
3
a3d42f724d2d4157aa6acf808b8f4052e57a657d
Cesar Eduardo Barros
2020-02-03T21:37:27
Inline wrapper methods
diff --git a/src/lib.rs b/src/lib.rs index 7444b75..979b4dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1085,6 +1085,7 @@ impl fmt::Debug for Hasher { } impl Default for Hasher { + #[inline] fn default() -> Self { Self::new() } diff --git a/src/traits.rs b/src/traits.rs index 0c24b45..570a446...
2
10
0
0651736ff45ba030a4933bf6f9cc5f38f8e87b19
Jack O'Connor
2020-02-03T15:20:45
make the inherent reset() method return &mut self
diff --git a/src/lib.rs b/src/lib.rs index 0f9ee6f..7444b75 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -798,7 +798,7 @@ impl Hasher { /// how much inlining the optimizer does, moving a `Hasher` might copy its /// entire CV stack, most of which is useless uninitialized bytes. This /// methods avoids that...
2
3
2
9ffe377d454f8f3fbb289370b3b8ad916e33779d
Jack O'Connor
2020-02-03T15:13:32
implement crypto_mac::Mac
diff --git a/Cargo.toml b/Cargo.toml index 31595aa..de5aac9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,7 @@ constant_time_eq = "0.1.5" rayon = { version = "1.2.1", optional = true } cfg-if = "0.1.10" digest = "0.8.1" +crypto-mac = "0.7.0" [dev-dependencies] page_size = "0.4.1" diff --git a/src/digest....
4
126
79
bcd424cab664923656b1c7d5c94ba9482fe7834f
Jack O'Connor
2020-02-02T22:40:30
mention the digest traits in the docs
diff --git a/src/digest.rs b/src/digest.rs index 78edbd7..43bedf0 100644 --- a/src/digest.rs +++ b/src/digest.rs @@ -1,3 +1,5 @@ +//! Implementations for commonly used traits from the `digest` crate. + use crate::{Hasher, OutputReader}; use digest::generic_array::{ typenum::{U32, U64}, diff --git a/src/lib.rs b/...
2
5
0
9bab77d2cfe2d35e9fcc5b19424ebf865e0c0c2e
Jack O'Connor
2020-02-02T15:25:43
implement traits from the digest crate
diff --git a/Cargo.toml b/Cargo.toml index f532d73..31595aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ c_avx512 = [] # which is currently x86-only. If "c_neon" is on, NEON support is assumed. Note # that AArch64 always supports NEON, but support on ARMv7 varies. c_neon = [] -std = [] +std = ["digest/...
3
85
1
e603983647cd4070edef0eca70cf4a4d8103dfe5
Jack O'Connor
2020-02-02T21:21:20
add Hasher::reset Closes https://github.com/BLAKE3-team/BLAKE3/issues/41.
diff --git a/src/lib.rs b/src/lib.rs index ac468df..31ed285 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -785,6 +785,23 @@ impl Hasher { Self::new_internal(&context_key_words, DERIVE_KEY_MATERIAL) } + /// Reset the `Hasher` to its initial state. + /// + /// This is functionally the same as overw...
2
26
0
78e858d0506d6dfa72b5b690cf4203e90af64b8a
Jack O'Connor
2020-01-21T17:09:42
expand comments about lazy merging
diff --git a/src/lib.rs b/src/lib.rs index 078a148..ac468df 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -785,7 +785,17 @@ impl Hasher { Self::new_internal(&context_key_words, DERIVE_KEY_MATERIAL) } - // See comment in push_cv. + // As described in push_cv() below, we do "lazy merging", delaying me...
1
44
26
ccadbad2446dea5bd5b15c2a94896075c837a54f
Jack O'Connor
2020-01-21T15:51:46
stack size in the optimized impl should be MAX_DEPTH + 1
diff --git a/src/lib.rs b/src/lib.rs index c206b5b..078a148 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -743,7 +743,12 @@ fn parent_node_output( pub struct Hasher { key: CVWords, chunk_state: ChunkState, - cv_stack: ArrayVec<[CVBytes; MAX_DEPTH]>, + // The stack size is MAX_DEPTH + 1 because we do lazy...
1
6
1
67262dff31461d3fb801f3fe01382abb77387735
Jack O'Connor
2020-01-20T23:50:35
double the maximum incremental subtree size 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.
diff --git a/src/lib.rs b/src/lib.rs index 135c914..c206b5b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -882,12 +882,17 @@ impl Hasher { debug_assert_eq!(CHUNK_LEN.count_ones(), 1, "power of 2 chunk len"); let mut subtree_len = largest_power_of_two_leq(input.len()); let count_so_f...
1
11
6
491f799fd93c320e1367729b757a530d245ddec0
Jack O'Connor
2020-01-20T17:02:50
clarify the --no-mmap logic a bit
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index 708cba2..beb8c38 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -42,7 +42,7 @@ fn clap_parse_argv() -> clap::ArgMatches<'static> { .arg( Arg::with_name(NO_MMAP_ARG) .long(NO_MMAP_ARG) - .help("Never...
1
12
14
273a679ddcad272796c09be678d161d278d9316e
Cesar Eduardo Barros
2020-01-20T14:09:37
b3sum: add no-mmap option Using mmap is not always the best option. For instance, if the file is truncated while being read, b3sum will receive a SIGBUS and abort. Follow ripgrep's lead and add a --no-mmap option to disable mmap. This can also help benchmark the mmap versus the read path, and help debug performance i...
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index 4d73d1a..708cba2 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -9,6 +9,7 @@ const FILE_ARG: &str = "file"; const LENGTH_ARG: &str = "length"; const KEYED_ARG: &str = "keyed"; const DERIVE_KEY_ARG: &str = "derive-key"; +const NO_MMAP_ARG: &str = "no...
2
28
4
a3147eb90921094a3b3a71f0db0308c9fe09a6f1
Jack O'Connor
2020-01-18T14:57:40
comment about parallelism
diff --git a/src/lib.rs b/src/lib.rs index cb15cbd..135c914 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -535,6 +535,10 @@ fn compress_parents_parallel( // wouldn't be able to implement exendable ouput.) Note that this function is // not used when the whole input is only 1 chunk long; that's a different // codepath. ...
1
6
1
e2ce07601f58c7a445b869a8d025eb2d55967ad1
Jack O'Connor
2020-01-17T18:36:09
edit the --raw help string
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index 0089eb5..4d73d1a 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -46,7 +46,7 @@ fn clap_parse_argv() -> clap::ArgMatches<'static> { .arg( Arg::with_name(RAW_ARG) .long(RAW_ARG) - .help("Raw output wi...
1
1
1
f26880e2824a63fb968adaa2b9ec528ddb679760
Albert Safin
2020-01-15T17:22:20
b3sum: do not mmap files smaller than 16 KiB
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index e6c6efd..2e24dd1 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -78,6 +78,9 @@ fn maybe_memmap_file(file: &File) -> Result<Option<memmap::Mmap>> { // Mapping an empty file currently fails. // https://github.com/danburkert/memmap-rs/is...
1
3
0
c2f90dfdb0ce8b33626f4b3fd789188417c9eb7b
phayes
2020-01-15T18:06:40
Adding tests for error conditions
diff --git a/src/lib.rs b/src/lib.rs index 2db7476..d0df5ee 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -114,7 +114,7 @@ const DERIVE_KEY_CONTEXT: u8 = 1 << 5; const DERIVE_KEY_MATERIAL: u8 = 1 << 6; /// Errors from parsing hex values -#[derive(Debug)] +#[derive(Debug, PartialEq)] pub enum ParseError { /// He...
2
10
1
3353f0e5a182e5d854fa7249fb711689fad29e68
phayes
2020-01-15T17:59:36
Updating from_hex to accept a &str instead of an ArrayString
diff --git a/src/lib.rs b/src/lib.rs index 71f5206..2db7476 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -177,12 +177,18 @@ impl Hash { s } - /// Parse a fixed-length hexidecimal string and return the resulting Hash. + /// Parse a hexidecimal string and return the resulting Hash. /// - /// ...
2
13
11
e60934a129420ed283a587dce77f30519d750307
Jack O'Connor
2020-01-15T15:41:06
more consistent use of Self in the reference impl
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index 16584cd..2488343 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -307,7 +307,7 @@ impl Hasher { /// Construct a new `Hasher` for the key derivation function. The context /// string sh...
1
1
1
aec1d88e3168b1c6549a89acd4b022bdbf31a2dc
phayes
2020-01-14T22:35:18
Using take() to limit the number of bytes copies
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index d8025da..7e8b5d0 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -124,16 +124,11 @@ fn write_hex_output(mut output: blake3::OutputReader, mut len: u64) -> Result<() Ok(()) } -fn write_raw_output(mut output: blake3::OutputReader, mut len: u64) ->...
1
3
8
cfa310a49798ec41ae1d00edc8c842b35e13bd7c
phayes
2020-01-14T20:37:42
Using enum for error type
diff --git a/src/lib.rs b/src/lib.rs index adb822e..71f5206 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -113,6 +113,16 @@ const KEYED_HASH: u8 = 1 << 4; const DERIVE_KEY_CONTEXT: u8 = 1 << 5; const DERIVE_KEY_MATERIAL: u8 = 1 << 6; +/// Errors from parsing hex values +#[derive(Debug)] +pub enum ParseError { + //...
1
16
7
b0841629f153c3377a19de86f8a34a616e017ba3
phayes
2020-01-14T20:07:46
Using static strings as errors for parsing hex
diff --git a/src/lib.rs b/src/lib.rs index 0b5e4e4..adb822e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -170,7 +170,7 @@ impl Hash { /// Parse a fixed-length hexidecimal string and return the resulting Hash. /// /// [`ArrayString`]: https://docs.rs/arrayvec/0.5.1/arrayvec/struct.ArrayString.html - pub...
1
11
10
71e98f1d3faebea5141676a4f5f1b8b172ada248
phayes
2020-01-14T19:50:28
Adding from_hex and implementing FromStr for Hash
diff --git a/src/lib.rs b/src/lib.rs index cb15cbd..0b5e4e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -166,6 +166,27 @@ impl Hash { } s } + + /// Parse a fixed-length hexidecimal string and return the resulting Hash. + /// + /// [`ArrayString`]: https://docs.rs/arrayvec/0.5.1/arrayvec/...
2
50
0
a02b4cb0406fc130a0c209882c085f3a87b6ff8d
phayes
2020-01-13T22:56:06
bailing early if we have both --raw and multiple files
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index a7d5944..d8025da 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -191,28 +191,26 @@ fn main() -> Result<()> { if let Some(files) = args.values_of_os(FILE_ARG) { if raw_output && files.len() > 1 { - did_error = true; - ...
1
17
19
0e8734b7f6c54ae871b15d9786ce1c0c1f30e3ad
phayes
2020-01-13T22:48:24
Making sure our raw multi-file test is testing what we think it is
diff --git a/b3sum/tests/test.rs b/b3sum/tests/test.rs index 5870296..5837bac 100644 --- a/b3sum/tests/test.rs +++ b/b3sum/tests/test.rs @@ -108,7 +108,15 @@ fn test_length_without_value_is_an_error() { #[test] fn test_raw_with_multi_files_is_an_error() { - let result = cmd!(b3sum_exe(), "--raw", "file1", "file2...
1
9
1
5cb01ad696b50929e2084b5dc21e5bb38770c975
phayes
2020-01-13T22:43:09
Using stdout_capture for capturing stdout that is not a string
diff --git a/b3sum/tests/test.rs b/b3sum/tests/test.rs index 2c55d2b..5870296 100644 --- a/b3sum/tests/test.rs +++ b/b3sum/tests/test.rs @@ -17,13 +17,13 @@ fn test_hash_one() { #[test] fn test_hash_one_raw() { let expected = blake3::hash(b"foo").as_bytes().to_owned(); - let mut stdout = Vec::new(); - let ...
1
6
6
2bd7614d1eb446399966f4a7771ca8152e548828
phayes
2020-01-13T22:40:30
Fixing stdout locking
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index 2703938..a7d5944 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -125,12 +125,13 @@ fn write_hex_output(mut output: blake3::OutputReader, mut len: u64) -> Result<() } fn write_raw_output(mut output: blake3::OutputReader, mut len: u64) -> Result<()> ...
1
3
2
ec1233bca3bda35608fa1f5b8a0cd43cfa922975
phayes
2020-01-13T22:36:28
Locking stdout for writing in a tight loop.
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index 81b9d20..2703938 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -125,7 +125,7 @@ fn write_hex_output(mut output: blake3::OutputReader, mut len: u64) -> Result<() } fn write_raw_output(mut output: blake3::OutputReader, mut len: u64) -> Result<()> { ...
1
1
1
8d251af29f0f961ef319691d89b75de0822a60d0
phayes
2020-01-13T21:12:47
Adds support for raw output to b3sum
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index e6c6efd..81b9d20 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -10,6 +10,7 @@ const LENGTH_ARG: &str = "length"; const KEYED_ARG: &str = "keyed"; const DERIVE_KEY_ARG: &str = "derive-key"; const NO_NAMES_ARG: &str = "no-names"; +const RAW_ARG: &str...
2
71
17
02250a7b7c80ded8f42fcf2caa9c26bdf042e820
Jack O'Connor
2020-01-13T19:47:28
version 0.1.1 Changes since 0.1.0: - Optimizations contributed by @cesarb. - Fix the build on x86_64-pc-windows-gnu when c_avx512 is enabled. - Add an explicit error message for compilers that don't support c_avx512.
diff --git a/Cargo.toml b/Cargo.toml index c429c1e..3bf7892 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blake3" -version = "0.1.0" +version = "0.1.1" authors = ["Jack O'Connor <oconnor663@gmail.com>"] description = "the BLAKE3 hash function" repository = "https://github.com/BLAKE3-te...
2
2
2
caa6622afadea443cc125a3b5d9990d32d366f71
Jack O'Connor
2020-01-12T01:13:08
explicitly check for -mavx512f or /arch:AVX512 support If AVX-512 is enabled, and the local C compiler doesn't support it, the build is going to fail. However, if we check for this explicitly, we can give a better error message. Fixes https://github.com/BLAKE3-team/BLAKE3/issues/6.
diff --git a/b3sum/Cargo.toml b/b3sum/Cargo.toml index d822a9d..76b1295 100644 --- a/b3sum/Cargo.toml +++ b/b3sum/Cargo.toml @@ -9,7 +9,7 @@ readme = "README.md" edition = "2018" [features] -default = ["rayon", "c_avx512"] +default = ["c_avx512", "rayon"] c_avx512 = ["blake3/c_avx512"] c_neon = ["blake3/c_neon"] ...
2
34
1
b9b1d485457f3ed1b113537e79448df9c56d5d25
Jack O'Connor
2020-01-11T15:40:44
avoid using MSVC-style flags with the GNU toolchain on Windows
diff --git a/build.rs b/build.rs index 3611258..14c054c 100644 --- a/build.rs +++ b/build.rs @@ -4,33 +4,33 @@ fn defined(var: &str) -> bool { env::var_os(var).is_some() } -fn target_arch() -> String { +fn target_components() -> Vec<String> { let target = env::var("TARGET").unwrap(); - let target_compon...
1
17
17
9f509a8f1f138f1089756fd996a688cd029733f0
Cesar Eduardo Barros
2020-01-11T16:04:25
Inline trivial functions For the Read and Write traits, this also allows the compiler to see that the return value is always Ok, allowing it to remove the Err case from the caller as dead code.
diff --git a/src/guts.rs b/src/guts.rs index 428e911..88dcc86 100644 --- a/src/guts.rs +++ b/src/guts.rs @@ -18,10 +18,12 @@ impl ChunkState { )) } + #[inline] pub fn len(&self) -> usize { self.0.len() } + #[inline] pub fn update(&mut self, input: &[u8]) -> &mut Self { ...
2
14
0
4690c5f14e066957cace7da8583b94f86cc1662b
Cesar Eduardo Barros
2020-01-11T22:06:58
Use fixed-size constant_time_eq The generic constant_time_eq has several branches on the slice length, which are not necessary when the slice length is known. However, the optimizer is not allowed to look into the core of constant_time_eq, so these branches cannot be elided. Use instead a fixed-size variant of consta...
diff --git a/Cargo.toml b/Cargo.toml index 40caead..c429c1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ std = [] [dependencies] arrayref = "0.3.5" arrayvec = { version = "0.5.1", default-features = false, features = ["array-sizes-33-128"] } -constant_time_eq = "0.1.4" +constant_time_eq = "0.1.5" # A ...
2
3
3
793c8a2444b2aa3873ff0f5192d9fcd28eb588bf
Jack O'Connor
2020-01-11T05:23:07
disambiguate the two test We can't change the context used in test_vectors.json without breaking people, but we can change the one in unit tests.
diff --git a/src/test.rs b/src/test.rs index df0822b..e85d3dc 100644 --- a/src/test.rs +++ b/src/test.rs @@ -298,7 +298,7 @@ fn test_compare_reference_impl() { // derive_key { - let context = "BLAKE3 2019-12-27 16:13:59 example context"; + let context = "BLAKE3 2019-12-27 16:13...
1
1
1
8d3f33802d8c4d9e0e3c59a8021f567ae127d90d
Jack O'Connor
2020-01-10T15:29:48
correct the comments around SIMD rotations
diff --git a/src/avx2.rs b/src/avx2.rs index 4d2eaa8..841b6e1 100644 --- a/src/avx2.rs +++ b/src/avx2.rs @@ -44,13 +44,13 @@ unsafe fn set8(a: u32, b: u32, c: u32, d: u32, e: u32, f: u32, g: u32, h: u32) - ) } -// These rotations are the "simple version". For the "complicated version", see +// These rotations a...
2
10
10
1d17689133610129a0acd78a53a99fc60bcf7958
Jack O'Connor
2020-01-10T15:00:17
same license field fix in b3sum/Cargo.toml
diff --git a/b3sum/Cargo.toml b/b3sum/Cargo.toml index 33b4d4e..d822a9d 100644 --- a/b3sum/Cargo.toml +++ b/b3sum/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Jack O'Connor <oconnor663@gmail.com>"] description = "a command line implementation of the BLAKE3 hash function" repository = "https://github.com/...
1
1
1
a7e11c7cf7ac2933bb85ce61a40251c98b69867f
Brendan Molloy
2020-01-10T12:42:25
Update license field in Cargo.toml Fixes the issue of crates.io not recognising the license, and using the `OR` terminology to describe the dual licensing option.
diff --git a/Cargo.toml b/Cargo.toml index 99b885c..40caead 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Jack O'Connor <oconnor663@gmail.com>"] description = "the BLAKE3 hash function" repository = "https://github.com/BLAKE3-team/BLAKE3" -license = "Apache-2.0" +license = "C...
1
1
1
0397d427400c82e9cc2ce08f384dab32bf128840
Leonard Buskin
2020-01-10T10:51:14
Fix misspelled words_from_little_endian_bytes
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index 51cbfb5..9e95f2d 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -105,7 +105,7 @@ fn first_8_words(compression_output: [u32; 16]) -> [u32; 8] { compression_output[0..8].try_into().unwrap()...
1
5
5
7f43ed9f470bee07b29807a4f2ac930288915b62
Jack O'Connor
2020-01-09T16:48:09
use the Apache-2.0 license in Cargo.toml This project is also CC0, but crates.io doesn't seem to understand that one.
diff --git a/Cargo.toml b/Cargo.toml index 418f071..99b885c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Jack O'Connor <oconnor663@gmail.com>"] description = "the BLAKE3 hash function" repository = "https://github.com/BLAKE3-team/BLAKE3" -license = "CC0" +license = "Apache-2...
2
2
2
3cf242b6516eaaf936b7a1550c4832c00bd4e359
Jack O'Connor
2020-01-09T15:50:55
fill out Cargo.toml files for publication
diff --git a/Cargo.toml b/Cargo.toml index 6b26198..418f071 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,11 @@ name = "blake3" version = "0.1.0" authors = ["Jack O'Connor <oconnor663@gmail.com>"] +description = "the BLAKE3 hash function" +repository = "https://github.com/BLAKE3-team/BLAKE3" +license = "CC0" +...
2
9
1
56ced5b422f0289e5a26aedf2a7bc452ace66f1f
Jack O'Connor
2020-01-09T14:14:20
switch the reference impl to use the single permutation
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index 855d8f0..51cbfb5 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -5,7 +5,6 @@ const OUT_LEN: usize = 32; const KEY_LEN: usize = 32; const BLOCK_LEN: usize = 64; const CHUNK_LEN: usize = 1024...
1
34
22
442775e3cef80817dc33a04de63d8fe95d1c9575
Jack O'Connor
2020-01-09T13:44:17
test_msg_schedule_permutation
diff --git a/src/lib.rs b/src/lib.rs index b8b3451..c7300d2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -659,7 +659,7 @@ pub fn hash(input: &[u8]) -> Hash { /// The keyed hash function. /// /// This is suitable for use as a message authentication code, for -/// example to replace an HMAC instance. +/// example to r...
2
17
1
ed81da9aaa488840cba22a48d40eefaed98fed23
JP Aumasson
2020-01-08T18:28:02
code comment
diff --git a/src/lib.rs b/src/lib.rs index e3ed996..b8b3451 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -658,8 +658,9 @@ pub fn hash(input: &[u8]) -> Hash { /// The keyed hash function. /// -/// This is suitable for use as a message authentication code, like HMAC. In -/// that use case, the constant-time equality c...
1
3
2
e04b8b1fed1f309d0a39aaa8953b805fc492efb2
Jack O'Connor
2020-01-07T22:44:50
clarify that b3sum --keyed takes raw key bytes
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index cb2bb15..e6c6efd 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -27,7 +27,7 @@ fn clap_parse_argv() -> clap::ArgMatches<'static> { Arg::with_name(KEYED_ARG) .long(KEYED_ARG) .requires(FILE_ARG) - ...
1
1
1
b0d775d5894b67edcbef43b49176c650e3a2c214
Jack O'Connor
2020-01-07T20:41:00
simplify the docs example
diff --git a/src/lib.rs b/src/lib.rs index e477357..e3ed996 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,9 +5,6 @@ //! //! ``` //! # fn main() -> Result<(), Box<dyn std::error::Error>> { -//! use blake3::{hash, Hasher}; -//! use std::io::prelude::*; -//! //! // Hash an input all at once. //! let hash1 = blake3::...
1
3
7
bee430b33557e6a630ee1424efe43a7f7a49c668
Jack O'Connor
2020-01-05T20:33:12
make the --length argument require a value
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index 3fc074c..cb2bb15 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -21,8 +21,7 @@ fn clap_parse_argv() -> clap::ArgMatches<'static> { .short("l") .takes_value(true) .value_name("LEN") - .de...
2
11
3
9fe42d0702d32d554b2911d8cba48feea6029b4d
Jack O'Connor
2020-01-05T18:29:50
warn not to use derive_key with passwords
diff --git a/src/lib.rs b/src/lib.rs index daebaa8..850c865 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -686,14 +686,20 @@ pub fn keyed_hash(key: &[u8; KEY_LEN], input: &[u8]) -> Hash { /// damage from one part of your application accidentally leaking its key. /// /// As a rare exception to that general rule, howeve...
1
9
3
72ba63ca86b3aa1d7052331641767614717c9ac7
Jack O'Connor
2020-01-05T02:49:38
turn on AVX-512 in the test vectors
diff --git a/test_vectors/Cargo.toml b/test_vectors/Cargo.toml index 47d98f1..007d1c8 100644 --- a/test_vectors/Cargo.toml +++ b/test_vectors/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] # If you ever change these path dependencies, you'll probably need to update # cross_test.sh, or CI will break. I'm ...
1
1
1
5b4f79fc7f49b47c1580e2e51aeaacbc2c4e6dd4
Jack O'Connor
2020-01-02T20:55:54
comment punctuation nit
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index d97256e..7f5d7f1 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -302,7 +302,7 @@ impl Hasher { // child off the stack, merge it with `new_cv`, and overwrite `new_cv` // with ...
1
1
1
dc324a189e75f67d34464b9eab574f1851481c06
Jack O'Connor
2019-12-29T16:37:16
add the guts module to share code with Bao
diff --git a/src/guts.rs b/src/guts.rs new file mode 100644 index 0000000..428e911 --- /dev/null +++ b/src/guts.rs @@ -0,0 +1,93 @@ +// This module is for incremental use cases like the `bao` crate, which need to +// get their hands on internal chunk and parent chaining values. The vast +// majority of users should ign...
2
105
4
ba2806496360aa61cc2aa64204a39d923cb13895
Jack O'Connor
2019-12-24T22:41:16
switch back to counting trailing 0 bits These things are totally equivalent, and I keep going back and forth, but now I think this is slightly clearer.
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index 3be4e5a..bb8b511 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -289,18 +289,17 @@ impl Hasher { self.cv_stack[self.cv_stack_len as usize] } - fn add_chunk_chaining_value(&m...
1
9
10
c9ffbdd36532b89a1163a33071a5569bcef02ceb
Jack O'Connor
2019-12-24T19:30:04
use self.flags instead of self.chunk_state.flags in the reference impl This is clearer, and because of padding requirements it doesn't change the size of the Hasher struct. (We have a test for this.)
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index bcc7ccc..3be4e5a 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -246,6 +246,7 @@ pub struct Hasher { key: [u32; 8], cv_stack: [[u32; 8]; 54], // Space for 54 subtree chaining values:...
1
5
3
8aae07f91aa22fda0312c3966961f7ab4c3743a5
Jack O'Connor
2019-12-24T19:10:34
switch from counting trailing 0 bits to counting trailing 1 bits
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index f6b7c8a..bcc7ccc 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -287,17 +287,18 @@ impl Hasher { self.cv_stack[self.cv_stack_len as usize] } - fn push_chunk_chaining_value(&...
1
13
12
6c1155a41d7b6a268d4daac296c4fd94f7d2273b
Jack O'Connor
2019-12-23T21:47:40
get rid of unnecessary variables in push_chunk_chaining_value
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index 9348fe5..f6b7c8a 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -287,7 +287,7 @@ impl Hasher { self.cv_stack[self.cv_stack_len as usize] } - fn push_chunk_chaining_value(&mu...
1
3
5
3016ddcb3add36e8bbdcf60b06be59b12f22d674
Jack O'Connor
2019-12-23T20:39:29
add a parent_cv helper function to the reference impl Also use fewer array references (the compiler doesn't care) be more explicit with a `new_cv` mutable variable. This clarifies push_chunk_chaining_value just a bit. Since that's the trickiest function in the entire thing, it's good to clarify it. (It also gets excer...
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index 486a1e2..9348fe5 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -149,9 +149,9 @@ struct ChunkState { } impl ChunkState { - fn new(key: &[u32; 8], chunk_counter: u64, flags: u32) -> Self...
1
39
29
021c7b66be860461b5790b28f2823c22514319c0
Jack O'Connor
2019-12-22T06:38:03
switch to simplified rotations This is a performance improvement on modern x86 chips (Skylake and later), and the LLVM optimizer can convert these to AVX-512 rotations when those are enabled.
diff --git a/src/avx2.rs b/src/avx2.rs index 3424a83..4d2eaa8 100644 --- a/src/avx2.rs +++ b/src/avx2.rs @@ -44,36 +44,32 @@ unsafe fn set8(a: u32, b: u32, c: u32, d: u32, e: u32, f: u32, g: u32, h: u32) - ) } +// These rotations are the "simple version". For the "complicated version", see +// https://github.co...
2
24
26
e800e0659fa953cbd1d2d10716dace4498c8f94a
Jack O'Connor
2019-12-22T21:27:27
rework push_chunk_chaining_value in terms of trailing 0's
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index 1ecf71e..486a1e2 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -283,12 +283,13 @@ impl Hasher { // right edge of the growing tree. For each completed subtree, pop its // lef...
1
5
4
e6e4e6d68711a8e38d7edf97017cd71aec721076
Jack O'Connor
2019-12-14T02:10:44
a few more comments in reference_impl.rs
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index 9416b4b..1ecf71e 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -114,16 +114,13 @@ impl Output { first_8_words(compress( &self.input_chaining_value, &self.bl...
1
7
4
b1b507d43a51ad721fbdf7796d6e3f3a6582d99d
Jack O'Connor
2019-12-13T20:56:21
make b3sum --keyed and --derive-key read the key from stdin Putting secret keys on the command line is bad practice, because command line args are usually globally visible within the OS. Even if these flags are mostly intended for testing and experimentation, we might as well do the right thing. Plus this saves people...
diff --git a/b3sum/Cargo.toml b/b3sum/Cargo.toml index 21084a8..c8e0c15 100644 --- a/b3sum/Cargo.toml +++ b/b3sum/Cargo.toml @@ -13,7 +13,6 @@ rayon = ["blake3/rayon", "memmap"] [dependencies] anyhow = "1.0.25" -arrayref = "0.3.5" blake3 = { version = "0.1", path = ".." } clap = { version = "2.33.0", default-feat...
3
70
43
1a6e8635137987e4e650dbf109897a6e7721257e
Jack O'Connor
2019-12-13T18:27:01
fix another warning in b3sum --no-default-features
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index 01d9261..6b8e10f 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -96,13 +96,13 @@ fn maybe_memmap_file(file: &File) -> Result<Option<memmap::Mmap>> { // The fast path: Try to hash a file by mem-mapping it first. This is faster if // it works, but it's...
1
4
4
f54c292a53f377bf905def362369fbeec01f889b
Jack O'Connor
2019-12-13T18:19:44
silence another warning in the --no-default-features tests
diff --git a/src/test.rs b/src/test.rs index 641fd33..af0bd1c 100644 --- a/src/test.rs +++ b/src/test.rs @@ -369,9 +369,9 @@ fn test_fuzz_hasher() { // Use a fixed RNG seed for reproducibility. let mut rng = rand_chacha::ChaCha8Rng::from_seed([1; 32]); - for num_test in 0..num_tests { + for _num_test ...
1
2
2
0c245f21bf7f7b723b9714815e73fa5cc72a0724
Jack O'Connor
2019-12-13T18:12:06
fix the doc tests build
diff --git a/src/lib.rs b/src/lib.rs index 4cb30f8..05690a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,6 +20,7 @@ //! assert_eq!(hash1, hash2); //! //! // Extended output. +//! # #[cfg(feature = "std")] { //! let mut output = Vec::new(); //! blake3::Hasher::new() //! .update(b"foobarbaz") @@ -28,6 +29,7 ...
1
2
0
811b5109c5c9dec7dfce6cebb678f66fa9874b0b
Jack O'Connor
2019-12-13T18:08:18
add --no-names to b3sum Printing all names by default is more consistent with Coreutils.
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs index 918789d..01d9261 100644 --- a/b3sum/src/main.rs +++ b/b3sum/src/main.rs @@ -32,6 +32,11 @@ fn clap_parse_argv() -> clap::ArgMatches<'static> { .conflicts_with("key") .help("The key derivation mode."), ) + .arg( + ...
1
6
1
04f5ccd648fab0ba76f000ae646c62b9fefc2e3c
Jack O'Connor
2019-12-13T16:06:10
expand the docs
diff --git a/src/lib.rs b/src/lib.rs index 9e61c4d..4cb30f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,37 @@ +//! The official Rust implementation of the [BLAKE3](https://blake3.io) +//! cryptographic hash function. +//! +//! # Examples +//! +//! ``` +//! # fn main() -> Result<(), Box<dyn std::error::Error>> {...
1
127
24
1384edd67cf0827cc3065867c39bf770663688d7
Jack O'Connor
2019-12-13T15:06:46
rename 1_chunk benchmarks to 1_kib
diff --git a/benches/bench.rs b/benches/bench.rs index 67eba85..77e1210 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -228,8 +228,8 @@ fn bench_atonce_0001_block(b: &mut Bencher) { } #[bench] -fn bench_atonce_0001_chunk(b: &mut Bencher) { - bench_atonce(b, CHUNK_LEN); +fn bench_atonce_0001_kib(b: &mut ...
1
6
6
fb0682c4c58f712cba5bbab15842f254b9562ee8
Jack O'Connor
2019-12-13T14:23:21
add 2 KiB benchmarks
diff --git a/benches/bench.rs b/benches/bench.rs index 8fefe61..67eba85 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -232,6 +232,11 @@ fn bench_atonce_0001_chunk(b: &mut Bencher) { bench_atonce(b, CHUNK_LEN); } +#[bench] +fn bench_atonce_0002_kib(b: &mut Bencher) { + bench_atonce(b, 2 * KIB); +} +...
1
15
0
fe9b8fedd7743ab017c7a3eab40a6128396bd4c9
Jack O'Connor
2019-12-13T04:31:02
fix benchmarks build
diff --git a/benches/bench.rs b/benches/bench.rs index da0f7d3..8fefe61 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -49,7 +49,7 @@ impl RandomInput { } type CompressInPlaceFn = - unsafe fn(cv: &mut [u32; 8], block: &[u8; BLOCK_LEN], block_len: u8, offset: u64, flags: u8); + unsafe fn(cv: &mut [u32...
1
23
5
b9a05913ee850891017f5d98f6d6c5eb3493f6c2
Jack O'Connor
2019-12-12T19:07:58
fix the test_vectors build
diff --git a/test_vectors/src/lib.rs b/test_vectors/src/lib.rs index be29c5f..2c06477 100644 --- a/test_vectors/src/lib.rs +++ b/test_vectors/src/lib.rs @@ -65,17 +65,20 @@ pub fn generate_json() -> String { let mut hash_out = [0; OUTPUT_LEN]; blake3::Hasher::new() .update(&input) - ...
1
14
11
3b5664c8a58731fc222f3007c54b6c73cdbbc42f
Jack O'Connor
2019-12-12T16:28:31
struct OutputReader
diff --git a/src/lib.rs b/src/lib.rs index 8ccf7c5..fdd3a16 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -175,6 +175,7 @@ impl fmt::Debug for Hash { // Each chunk or parent node can produce either a 32-byte chaining value or, by // setting the ROOT flag, any number of final output bytes. The Output struct // captures...
2
155
22
c8d21fab957a0a5c9c42b9a8e657c4dec7f87f58
Jack O'Connor
2019-12-12T03:41:59
account for Windows newlines when checking for test vector changes
diff --git a/test_vectors/src/lib.rs b/test_vectors/src/lib.rs index 18a4497..be29c5f 100644 --- a/test_vectors/src/lib.rs +++ b/test_vectors/src/lib.rs @@ -307,7 +307,9 @@ mod tests { #[test] fn test_checked_in_vectors_up_to_date() { - let json = read_test_vectors_file(); + // Replace Windows...
1
3
1
1a57232b492b110fcab75bd4265b9cd03e559009
Jack O'Connor
2019-12-12T03:32:53
delete an unused import
diff --git a/src/c_avx512.rs b/src/c_avx512.rs index 0120a2c..e66f102 100644 --- a/src/c_avx512.rs +++ b/src/c_avx512.rs @@ -1,5 +1,4 @@ use crate::{CVWords, OffsetDeltas, BLOCK_LEN, OUT_LEN}; -use arrayref::array_ref; pub const DEGREE: usize = 16;
1
0
1
d68882da0d897c93a271a7c0f6d6b9b13d13aa16
Jack O'Connor
2019-12-11T16:02:23
test_checked_in_vectors_up_to_date
diff --git a/test_vectors/src/bin/generate.rs b/test_vectors/src/bin/generate.rs index 9fb8ba4..3c618c1 100644 --- a/test_vectors/src/bin/generate.rs +++ b/test_vectors/src/bin/generate.rs @@ -1,41 +1,4 @@ -// A non-multiple of 4 is important, since one possible bug is to fail to emit -// partial words. -const OUTPUT_L...
2
73
50
d183149b2e4d5f702de1abb51584c343e7e99573
Jack O'Connor
2019-12-11T15:14:24
add the test_vectors sub-crate
diff --git a/test_vectors/Cargo.toml b/test_vectors/Cargo.toml new file mode 100644 index 0000000..aa4c0e7 --- /dev/null +++ b/test_vectors/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "test_vectors" +version = "0.0.0" +edition = "2018" + +[dependencies] +blake3 = { path = "../" } +hex = "0.4.0" +reference_impl = { p...
3
114
0
0c444972904d25a836cba11ac9b2561f253f9b4e
Jack O'Connor
2019-12-09T04:31:18
s/subtree_stack/cv_stack/ in reference_impl.rs This fits better with the current wording of the spec.
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index 396b1ce..f90b07d 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -232,8 +232,8 @@ fn parent_output( pub struct Hasher { chunk_state: ChunkState, key: [u32; 8], - subtree_stack: [[...
1
11
11
ee0014776fbb8c0a93965ff7ef29d8281a4421a4
Jack O'Connor
2019-12-09T02:58:32
silence an unreachable code warning when "c_neon" is in use
diff --git a/src/platform.rs b/src/platform.rs index 99db59a..4621fc5 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -49,6 +49,7 @@ pub enum Platform { } impl Platform { + #[allow(unreachable_code)] pub fn detect() -> Self { #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
1
1
0
ae7271cc87c6f7f5743563a208f693fbf901fe8c
Jack O'Connor
2019-12-08T23:17:09
add benchmarks for AVX-512 and NEON
diff --git a/benches/bench.rs b/benches/bench.rs index 571e18b..ec7658c 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -80,6 +80,15 @@ fn bench_single_compression_sse41(b: &mut Bencher) { bench_single_compression_fn(b, blake3::sse41::compress); } +#[bench] +#[cfg(feature = "c_avx512")] +fn bench_single...
3
45
0
78191a676fbd2e58fd24e49e019e7d670b5b43ea
Jack O'Connor
2019-12-08T23:04:59
feature comments in Cargo.toml
diff --git a/Cargo.toml b/Cargo.toml index 756703c..fbdd9e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,14 @@ edition = "2018" [features] default = ["std"] +# Like SSE4.1 and AVX2, the AVX-512 implementation uses dynamic feature +# detection, so a binary with "c_avx512" on is still cross-platform. c_avx512...
1
7
0
1574b488f9bcf2207a9bf5e2763c21630065713a
Jack O'Connor
2019-12-08T22:58:42
unify the platform-specific tests and test AVX-512 and NEON
diff --git a/src/avx2.rs b/src/avx2.rs index 15ff154..14673c6 100644 --- a/src/avx2.rs +++ b/src/avx2.rs @@ -428,8 +428,6 @@ pub unsafe fn hash_many<A: arrayvec::Array<Item = u8>>( #[cfg(test)] mod test { use super::*; - use crate::*; - use arrayref::array_ref; #[test] fn test_transpose() { @@ ...
6
174
567
c7fff32392756473bc74f36b1d894121b7201912
Jack O'Connor
2019-12-08T04:43:45
add Rust FFI wrappers for AVX-512 and NEON
diff --git a/Cargo.toml b/Cargo.toml index 61d4f91..756703c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,9 @@ authors = ["Jack O'Connor <oconnor663@gmail.com>"] edition = "2018" [features] -default = ["c", "std"] -c = [] +default = ["std"] +c_avx512 = [] +c_neon = [] std = [] [dependencies] @@ -14,6 +15,...
6
343
10
0cb4f6dd2cadbe9fa03a1eabeb3359d3bc66ebcc
Jack O'Connor
2019-12-08T03:23:58
fix a bad assert This would fire (incorrectly) on platforms where MAX_SIMD_DEGREE=1.
diff --git a/src/lib.rs b/src/lib.rs index 755d45f..592d052 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -450,7 +450,7 @@ fn compress_parents_parallel( debug_assert_eq!(child_chaining_values.len() % OUT_LEN, 0, "wacky hash bytes"); let num_children = child_chaining_values.len() / OUT_LEN; debug_assert!(nu...
1
1
1
bcb99ba087031a320d053c5911f57a837a264ed9
Jack O'Connor
2019-12-08T03:02:19
fix the benchmarks build
diff --git a/benches/bench.rs b/benches/bench.rs index 62cc8d4..571e18b 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -84,7 +84,7 @@ type HashManyFn<A> = unsafe fn( inputs: &[&A], key: &[u8; blake3::KEY_LEN], offset: u64, - offset_deltas: &[u64; 16], + offset_deltas: &[u64; 17], flag...
1
3
3
c7a1f6e919db71f384969685897e86f056550824
Jack O'Connor
2019-12-08T02:55:13
add the OffsetDeltas type alias I'm about to add C integration for AVX-512 and NEON, and this matches better what the C code is doing.
diff --git a/src/avx2.rs b/src/avx2.rs index a7a0de7..15ff154 100644 --- a/src/avx2.rs +++ b/src/avx2.rs @@ -3,7 +3,7 @@ use core::arch::x86::*; #[cfg(target_arch = "x86_64")] use core::arch::x86_64::*; -use crate::{offset_high, offset_low, BLOCK_LEN, IV, KEY_LEN, MSG_SCHEDULE, OUT_LEN}; +use crate::{offset_high, o...
5
20
14
d6fbb03d018ace9de2cfb6380afe7923ba7af186
Jack O'Connor
2019-12-08T02:46:56
add reference impl benchmarks
diff --git a/benches/bench.rs b/benches/bench.rs index 490e415..62cc8d4 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -227,6 +227,16 @@ fn bench_atonce_0128_kib(b: &mut Bencher) { bench_atonce(b, 128 * KIB); } +#[bench] +fn bench_atonce_0256_kib(b: &mut Bencher) { + bench_atonce(b, 256 * KIB); +} +...
1
86
0
6edabea57a6ce59339f3d58c024af0556ee48135
Jack O'Connor
2019-12-08T02:45:42
provide BLAKS3_FUZZ_ITERATIONS for running a longer fuzz test
diff --git a/src/test.rs b/src/test.rs index b93c656..fd6e2ba 100644 --- a/src/test.rs +++ b/src/test.rs @@ -214,8 +214,15 @@ fn test_fuzz_hasher() { paint_test_input(&mut input_buf); // Don't do too many iterations in debug mode, to keep the tests under a - // second or so. CI should run tests in releas...
1
9
2
4b2d85675463a42a2e9536cb97591206e7bd266c
Jack O'Connor
2019-12-06T22:18:39
add many_parents benchmarks
diff --git a/benches/bench.rs b/benches/bench.rs index 6303caf..490e415 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -4,6 +4,7 @@ extern crate test; use arrayref::array_ref; use arrayvec::ArrayVec; +use blake3::platform::MAX_SIMD_DEGREE; use blake3::{BLOCK_LEN, CHUNK_LEN, KEY_LEN, OUT_LEN}; use rand::p...
1
63
17
19471453f5df895122faf40f2142f12ace8ffd98
Jack O'Connor
2019-12-06T20:42:53
add bench.rs
diff --git a/benches/bench.rs b/benches/bench.rs new file mode 100644 index 0000000..6303caf --- /dev/null +++ b/benches/bench.rs @@ -0,0 +1,237 @@ +#![feature(test)] + +extern crate test; + +use arrayref::array_ref; +use arrayvec::ArrayVec; +use blake3::{BLOCK_LEN, CHUNK_LEN, KEY_LEN, OUT_LEN}; +use rand::prelude::*; ...
2
251
7
912ae19bce02dc9d41f593c49d3bded70994b066
Jack O'Connor
2019-12-06T20:32:20
get rid of the bitflags dependency
diff --git a/Cargo.toml b/Cargo.toml index c219998..61d4f91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,6 @@ std = [] [dependencies] arrayref = "0.3.5" arrayvec = { version = "0.5.1", default-features = false, features = ["array-sizes-33-128"] } -bitflags = "1.2.1" constant_time_eq = "0.1.4" rayon = { ve...
5
74
93
47ef3ad01fec3bd02d9f8b2d3a04d8d5cdffbba0
Jack O'Connor
2019-12-05T22:56:19
add struct Hasher
diff --git a/Cargo.toml b/Cargo.toml index f346512..c219998 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,8 @@ rayon = { version = "1.2.1", optional = true } [dev-dependencies] page_size = "0.4.1" rand = "0.7.2" +rand_chacha = "0.2.1" reference_impl = { path = "./reference_impl" } [build-dependencies] -c...
4
514
66
5458066da95bd73e2c813264959106d2135e16af
Jack O'Connor
2019-12-04T22:39:06
add hash/keyed_hash/derive_key and tests against reference_impl.rs
diff --git a/src/lib.rs b/src/lib.rs index cfe9126..8bd7302 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,10 +27,15 @@ pub const BLOCK_LEN: usize = 64; #[doc(hidden)] pub const CHUNK_LEN: usize = 2048; -const IV: [u32; 8] = [ +const IV: &[u32; 8] = &[ 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527...
4
104
24
1ed705374d89a373fad7aa5c1d66821267100f08
Jack O'Connor
2019-12-04T21:55:50
add a few tests for the arithmetic helpers
diff --git a/src/test.rs b/src/test.rs index 0d47b54..4799052 100644 --- a/src/test.rs +++ b/src/test.rs @@ -1,4 +1,6 @@ +use crate::CHUNK_LEN; use core::cmp; +use core::usize; pub const TEST_KEY: [u8; crate::KEY_LEN] = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,...
1
51
0
a274a9b0faa444dd842a0584483eae6e97dbf21e
Jack O'Connor
2019-12-03T23:54:51
add recursive subtree hashing
diff --git a/src/lib.rs b/src/lib.rs index e946f27..cfe9126 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,11 +9,11 @@ mod sse41; #[cfg(test)] mod test; -use arrayref::array_ref; -use arrayvec::ArrayString; +use arrayref::{array_mut_ref, array_ref}; +use arrayvec::{ArrayString, ArrayVec}; use core::cmp; use core:...
2
263
8
7736b254cef487147408f13b175c1ac6d5c41b37
Jack O'Connor
2019-12-03T21:23:19
implementation notes
diff --git a/src/lib.rs b/src/lib.rs index e95dd82..e946f27 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -302,3 +302,17 @@ impl fmt::Debug for ChunkState { ) } } + +// IMPLEMENTATION NOTE +// =================== +// hash_subtree() is the basis of high-performance BLAKE3. We use it both for +// all-at-once...
2
24
0
ccdff5db592ca7a46d82dea0ac5973f825cef2db
Jack O'Connor
2019-12-03T20:46:58
add struct ChunkState
diff --git a/src/lib.rs b/src/lib.rs index 1e9c7b8..e95dd82 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,6 +11,7 @@ mod test; use arrayref::array_ref; use arrayvec::ArrayString; +use core::cmp; use core::fmt; use platform::Platform; @@ -158,18 +159,19 @@ impl Output { &self.block, s...
2
133
20
aa6134d287e28838aac06880896120b96d0cf675
Jack O'Connor
2019-12-03T20:18:16
add struct Output
diff --git a/src/lib.rs b/src/lib.rs index bc723cf..1e9c7b8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -138,3 +138,54 @@ impl fmt::Debug for Hash { write!(f, "Hash(0x{})", self.to_hex()) } } + +// Each chunk or parent node can produce either a 32-byte chaining value or, by +// setting the ROOT flag, any...
1
51
0
07890f36f6b4b613b2702fbce7db5c31d3b3428f
Jack O'Connor
2019-12-03T20:18:08
switch from words to bytes in representing chaining values
diff --git a/src/avx2.rs b/src/avx2.rs index cb60b0a..88cc157 100644 --- a/src/avx2.rs +++ b/src/avx2.rs @@ -3,7 +3,7 @@ use core::arch::x86::*; #[cfg(target_arch = "x86_64")] use core::arch::x86_64::*; -use crate::{offset_high, offset_low, BLOCK_LEN, IV, MSG_SCHEDULE, OUT_LEN}; +use crate::{offset_high, offset_low...
6
139
152
daad5a55b6e98fdd1b9ae42f311cc6532db630f6
Jack O'Connor
2019-12-03T18:44:30
add no_std support
diff --git a/src/avx2.rs b/src/avx2.rs index 78aa5d6..cb60b0a 100644 --- a/src/avx2.rs +++ b/src/avx2.rs @@ -432,7 +432,7 @@ mod test { #[test] fn test_transpose() { - if !is_x86_feature_detected!("avx2") { + if !crate::platform::avx2_detected() { return; } @@ -464,7 +4...
4
51
13
ad97e2b1601c43cbd65e638e2664da2b5548c6d5
Jack O'Connor
2019-12-03T18:34:12
add struct Hash
diff --git a/src/lib.rs b/src/lib.rs index 7b59a0d..67f9d52 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,6 @@ use arrayref::{array_refs, mut_array_refs}; +use arrayvec::ArrayString; +use core::fmt; #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] mod avx2; @@ -109,3 +111,58 @@ fn offset_low(offset: ...
1
57
0
c01b725bc7938b30c3d912145501233faebd2028
Jack O'Connor
2019-12-03T18:27:28
add platform.rs
diff --git a/src/lib.rs b/src/lib.rs index c6b195f..7b59a0d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,6 +2,7 @@ use arrayref::{array_refs, mut_array_refs}; #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] mod avx2; +mod platform; mod portable; #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] ...
3
118
1