-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch the BLAKE2 implementation to blake2b_simd/blake2s_simd
This is mostly a large performance improvement. The BLAKE2b bench_10000 case is improved by about 30%. This implementation also detects SIMD support at runtime, so the feature flags related to SIMD support are removed. The only performance loss is in the bench_10 cases, where the caller repeatedly feeds input slices less than one block long. The BLAKE2s bench_10 case is almost 20% slower. I'm not sure exactly why, but this implementation optimizes for avoiding copies on long runs of input, so it might just be that it's doing more math up front. This performance issue disappears if the inputs are a full block or longer. The only API consequence of this change is that the undocumented with_parameter_block constructor is no longer supported. Callers who need other parameters might prefer to use the blake2b_simd/blake2s_simd APIs directly, which expose them in a safer way through a Params object.
- Loading branch information
1 parent
526cc6e
commit 4c5dc2f
Showing
15 changed files
with
41 additions
and
884 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
use digest::generic_array::typenum::U64; | ||
use consts::BLAKE2B_IV; | ||
|
||
blake2_impl!(VarBlake2b, Blake2b, u64, u64x4, U64, | ||
32, 24, 16, 63, BLAKE2B_IV, | ||
blake2_impl!(VarBlake2b, Blake2b, u64, U64, | ||
"Blake2b instance with a variable output.", | ||
"Blake2b instance with a fixed output.", | ||
blake2b_simd, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
use digest::generic_array::typenum::U32; | ||
use consts::BLAKE2S_IV; | ||
|
||
blake2_impl!(VarBlake2s, Blake2s, u32, u32x4, U32, | ||
16, 12, 8, 7, BLAKE2S_IV, | ||
blake2_impl!(VarBlake2s, Blake2s, u32, U32, | ||
"Blake2s instance with a variable output.", | ||
"Blake2s instance with a fixed output.", | ||
blake2s_simd, | ||
); |
Oops, something went wrong.