aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash/sm3/sm3.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Avoid including rotate.h in bswap.hJack Lloyd2018-12-211-0/+1
| | | | | | | It was only needed for one case which is easily hardcoded. Include rotate.h in all the source files that actually use rotr/rotl but implicitly picked it up via loadstor.h -> bswap.h -> rotate.h include chain.
* Interleave SM3 message expansionJack Lloyd2017-10-121-141/+142
| | | | Reduces stack usage and a bit faster
* Add compile-time rotation functionsJack Lloyd2017-10-121-62/+62
| | | | | | | | | | | | | | | | | The problem with asm rol/ror is the compiler can't schedule effectively. But we only need asm in the case when the rotation is variable, so distinguish the two cases. If a compile time constant, then static_assert that the rotation is in the correct range and do the straightforward expression knowing the compiler will probably do the right thing. Otherwise do a tricky expression that both GCC and Clang happen to have recognize. Avoid the reduction case; instead require that the rotation be in range (this reverts 2b37c13dcf). Remove the asm rotations (making this branch illnamed), because now both Clang and GCC will create a roll without any extra help. Remove the reduction/mask by the word size for the variable case. The compiler can't optimize that it out well, but it's easy to ensure it is valid in the callers, especially now that the variable input cases are easy to grep for.
* Unroll SM3 compression functionJack Lloyd2017-10-101-56/+94
|
* Cleanups in SM3 codeJack Lloyd2017-06-291-81/+25
| | | | | | | | T[] variable is actually a constant, so precompute it in SM3_TJ W1 expansion is very simple and can just be done inline. Somewhat faster on my machine.
* Add HashFunction::copy_stateJack Lloyd2017-05-221-0/+5
| | | | See GH #1037
* Re-roll two loops in SM3 hash compression function that are causing test ↵Daniel Wyatt2017-04-041-94/+32
| | | | failures for some compilers.
* Unroll loops in SM3 hash compress_n.Daniel Wyatt2017-04-031-59/+240
|
* Add SM3 hash functionDaniel Wyatt2017-04-031-0/+150