File tree 3 files changed +19
-3
lines changed
3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
6
6
and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
7
7
8
- ## 0.9.7 (2021-09-08)
8
+ ## 0.9.7 (2021-09-08) [ YANKED ]
9
9
### Added
10
10
- x86 intrinsics support for SHA-512 ([ #312 ] )
11
11
Original file line number Diff line number Diff line change @@ -106,8 +106,8 @@ unsafe fn load_data_avx2(
106
106
107
107
macro_rules! unrolled_iterations {
108
108
( $( $i: literal) ,* ) => { $(
109
- x[ $i] = _mm256_insertf128_si256( x[ $i] , _mm_loadu_si128( data. add( $i) as * const _) , 1 ) ;
110
- x[ $i] = _mm256_insertf128_si256( x[ $i] , _mm_loadu_si128( data. add( $i + 1 ) as * const _) , 0 ) ;
109
+ x[ $i] = _mm256_insertf128_si256( x[ $i] , _mm_loadu_si128( data. add( 8 + $i) as * const _) , 1 ) ;
110
+ x[ $i] = _mm256_insertf128_si256( x[ $i] , _mm_loadu_si128( data. add( $i) as * const _) , 0 ) ;
111
111
112
112
x[ $i] = _mm256_shuffle_epi8( x[ $i] , MASK ) ;
113
113
Original file line number Diff line number Diff line change @@ -24,6 +24,22 @@ fn sha256_1million_a() {
24
24
one_million_a :: < sha2:: Sha256 > ( output) ;
25
25
}
26
26
27
+ #[ test]
28
+ #[ rustfmt:: skip]
29
+ fn sha512_avx2_bug ( ) {
30
+ use sha2:: Digest ;
31
+ use hex_literal:: hex;
32
+
33
+ let mut msg = [ 0u8 ; 256 ] ;
34
+ msg[ 0 ] = 42 ;
35
+ let expected = hex ! ( "
36
+ 2a3e943072f30afa45f2bf57ccd386f29b76dbcdb3a861224ca0b77bc3f55c7a
37
+ d3880a49c0c9c166eedf7f209c41b380896886155acb8f6c7c07044343a3e692
38
+ " ) ;
39
+ let res = sha2:: Sha512 :: digest ( & msg) ;
40
+ assert_eq ! ( res[ ..] , expected[ ..] ) ;
41
+ }
42
+
27
43
#[ test]
28
44
fn sha512_1million_a ( ) {
29
45
let output = include_bytes ! ( "data/sha512_one_million_a.bin" ) ;
You can’t perform that action at this time.
0 commit comments