-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API design #17
Comments
I would like to endorse my version of sha1 which was derived from rust-crypto. I believe it addresses all issues your mentioned, except I hope one day it will be published under
But unfortunately mitsuhiko didn't give a clear answer to my request. |
@newpavlov i replied to an email you sent that I will not replace this crate with a widely different one. You are free to publish rust-crypto-sha1 etc. |
@CasualX to answer the questions:
I don't see a reason why one would want to restrict this functionality. I have written code that requires this in the past. Likewise I am not sure what the point is in removing
I don't think there is a reason to this other than that some of the changes that made it work without stdlib changed the implementation to be based this way.
Works for me, i would accept patches for this. |
@mitsuhiko |
@newpavlov I am not sure what exactly you want from me other than complete surrender of the crate here. I already mentioned before that I do not like the idea that rust-crypto crates are not prefixed with There is already a lot of code that depends on this crate and replacing this crate with a completely different one is not something I think is a reasonable step forward. Not sure what you want in the README. If people are looking for rust crypto they will find it. |
@mitsuhiko Argument about dependent code looks like fallacy to me. We have semver exactly for such kind of situations. All users who don't want or unable to update their code to a new API will continue to use sha1 v0.2 as nothing happened. Also I am not insisting on transferring crate ownership (though I think it would be reasonable if in case of cooperation you'll give a write access to RustCrypto admins, so it will be possible to publish updates in your absence) and on closing this repository. I can mirror code to RustCrypto and your repository can stay as the main one. (though it will be certainly inconvenient and confusing for potential contributors) Regarding readme, I was talking about removal of this part:
|
I'm going to close this issue as I'm unable to do something with it. |
@mitsuhiko Is this still the same until now? This crate seemed unmaintained as it have no commit since 2018. |
I am looking through the code and I am curious about some of the API choices made:
Why is
Sha1
not an affine typeSha1::digest
could takeself
by value and produce aDigest
. This let's the type system prevent mistakes where one reuses theSha1
without also resetting.I'm not sure if it's useful anywhere to produce a digest and not reset/be done with the
Sha1
state.Sha1::reset
is not necessary, to reset a variable simply overwrite it withSha1::new()
. The compiler will optimize this as efficient as using areset
method but with benefit of type safety.Why doesn't
Digest
just store the bytes in the correct endianness?This would clean up the
as_bytes()
API to just return a&[u8]
making multiple calls more efficient, both API wise and performance wise.Implement
Debug
which dumps internal state and reserveDisplay
onDigest
for actually displaying the bytes as expected.I understand that changing API is a big commitment and there may be no desire to do so as the code has existed for a long time already. That said I am willing to make the changes and pull request them.
Any thoughts?
The text was updated successfully, but these errors were encountered: