Uses old Rust 2015
0.0.2 |
|
---|
#10 in #fixes
98KB
361 lines
The SHA1 Performance Quest
Follow me on my quest to bring the performance of this implementation up to comparable speeds with respective versions in Go and C !
At Episode 1 we start out at just 180MB/s, whereas C clocks in at 400MB/s, and Go at a whopping 450MB/s .
Watch all Episodes to learn what can be done to make it faster.
But ... will it be comparable or even out-pace the competition ?
Conclusion
It didn't quite work out as I hoped, as I would have been content only when reaching at least the 400MB/s mark delivered by the highly optimized C implementation. However, after re-implementing the highly-efficient Go version of the SHA-1 hashing algorithm, we turn out to process only ~320MB/s - far away from the 450MB/s that Go produces.
Unfortunately, due to the added complexity and lack of understanding the entire implementation, a bug or two have slipped into our Go-implementation clone, causing it to malfunction. Maybe it's an easy fix ... maybe.
For me it will be best to not spend more time on this, in an attempt to be happy with the working 280MB/s I achieved by myself.
After all, I am content that the fantastic Rust community will at some point produce the SHA1 implementation I always dreamed of.
rust-sha1-hasher
Minimal implementation of SHA1 for Rust. This might go away in the future if rust-crypto or some libraries like that split into smaller parts.
Right now SHA1 is quite frequently used and many things want to have an implementation of it, that does not pull in too much other stuff.
This is largely based on the hash code in crypto-rs by Koka El Kiwi.
This fork also adds some fixes for long data hashing (original version
has bug with hashing data built with several update()
calls)
and reimplements functionality using Hash
and Hasher
traits
from Rust's standard lib, making it more composable.