Closed timvisee closed 6 years ago
@warner Awesome. I believe I'm getting similar results.
What about implementing a similar method as before through a PR on hmac
to get similar performance?
@timvisee
Reset methods were reworked a bit in the latest trait versions. There is now a dedicated reset(&mut self)
method and result_reset()
methods are defined as a combination of reset and result methods. Code can be seen here. And HMAC reset method can be seen here. I hoped that optimizer will be smart enough to remove unnecessary operations, but I guess there is a small performance regression, maybe forcing inlining could improve situation a bit. Because regression is in the range of the measurement error I think we can merge this PR as-is.
This PR updates the
digest
dependency to version 0.8 (newest), and includes various refactorings to support this change. More crates start depending on these newerdigest
andhmac
versions, thus an update is required. This might be considered breaking, as the set of required traits has changed caused byhmac
. This PR does solve issue #20 .The following crates have been updated to their newest version:
digest
hmac
sha-1
(dev)sha2
(dev)I've removed
generic-array
as it seems to be redundant, it is re-exported/provided bydigest
now.Note that on line 60 in
hkdf.rs
, I've replacedresult().code()
withresult_reset().code()
as Rust was complaining about use-after-move issues, because the oldresult()
consumes thehmac
. I'm not 100% if this change is correct, this might introduce an extra clone, I don't know.Unit tests and benchmarks succeed on
rustc 1.29.2 (17a9dc751 2018-10-05)
andrustc 1.31.0-nightly (4699283c5 2018-10-13)
.