Skip to content

Switch from SHA-1 to MD4 or something else cheap #859

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

Closed
pcwalton opened this issue Aug 23, 2011 · 10 comments
Closed

Switch from SHA-1 to MD4 or something else cheap #859

pcwalton opened this issue Aug 23, 2011 · 10 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. I-slow Issue: Problems and improvements with respect to performance of generated code.
Milestone

Comments

@pcwalton
Copy link
Contributor

SHA-1 is high in the profiles (4.8%). We don't need the strong cryptographic properties AFAICT.

@brson
Copy link
Contributor

brson commented Aug 23, 2011

This is fine, but we're also using a very inefficient sha-1 implementation. I'm sure it's profile would drop considerably if we used git's.

@eholk
Copy link
Contributor

eholk commented Aug 23, 2011

I like that our SHA-1 implementation is written in Rust. Is the fact that it's slow because we wrote it in Rust, or because we wrote it in Rust using an inefficient algorithm?

@brson
Copy link
Contributor

brson commented Aug 23, 2011

It's probably both. The Rust version is based on the reference implementation, which is not fast. Trying to optimize it could be a good experiment, but git's version uses a lot of tricks. I don't really like the idea of using a C implementation of SHA-1 either and I don't have any opposition to using MD4.

@marijnh
Copy link
Contributor

marijnh commented Jan 17, 2012

I tried this today, and the performance gain was minimal. The MD4 hasher is in std::md4 now. It's moderately optimized, but I was forced to do some crummy things like manually assembling u32s from u8s and allocating a fixed-length vector on the heap.

@graydon
Copy link
Contributor

graydon commented Mar 11, 2012

If you're willing to drop strong cryptographic properties (which may well be fine in the context we're using this) then just switch to a modern non-CHF like spooky, murmur or city. Actually, might as well just put all 3 of those in our library: they're useful and one or another ought to be our default hash.

http://code.google.com/p/smhasher/
http://code.google.com/p/cityhash/
http://www.burtleburtle.net/bob/hash/spooky.html

All of them are much faster than md4.

@brson
Copy link
Contributor

brson commented Mar 11, 2012

There's a Rust implementation of murmur here

@brson
Copy link
Contributor

brson commented Mar 11, 2012

I haven't heard of sha1 being high in our profiles lately though, so it may not be as big of a concern as it once was.

@brson
Copy link
Contributor

brson commented Mar 15, 2012

sha1 is still around 1% of profiles

@catamorphism
Copy link
Contributor

We have to switch the remaining sha1 code to use sip in order for this bug to be resolved.

@graydon
Copy link
Contributor

graydon commented Jul 30, 2012

Closed by 1854a73

@graydon graydon closed this as completed Jul 30, 2012
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
Use IFF_OACTIVE and IFF_RUNNING even on FreeBSD. Deprecate the DRV ones.

According to @asomers, libc should propagate the use of the portable constants `IFF_OACTIVE` and `IFF_RUNNING` for user-space applications, instead of `IFF_DRV_OACTIVE` and `IFF_DRV_RUNNING`. It least that's my understanding of [his comment](nix-rust/nix#667 (comment)) in nix-rust/nix#667.
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
* Add custom anonymous type for tape

* Fix cast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

6 participants