4 ms·
What if the use case is not security sensitive, I just want to implement a distributed hash ring for example?
by StreamBright 9y ago
What if the use case is not security sensitive, I just want to implement a distributed hash ring for example?
- bradleyjg 9y agoIf the application isn't security sensitive why not a faster non-cryptographic hash like farmhash?
- takeda 9y agoMaybe because it is less popular, this is first time I hear about it. Probably it's also not as widely available.
- StreamBright 9y agoI agree. There is also siphash that we use.
- dom0 9y agoThese are often not packaged, so less available. Though for some applications you wouldn't want a library anyway. (Also, xxhash)
- stouset 9y agoBLAKE2 is faster and has features you might find useful in that sort of scenario. And doesn't forfeit security, should you decide to use this in a an unexpectedly security-sensitive application.
- btrask 9y agoIf the use case isn't security critical, and you know for a fact it won't become security critical later, and MD5 is convenient for whatever reason, then just use MD5. Pardon my frustration, but: Jesus Christ, people. Why do we need to sell everyone on the fancy new thing in a hypothetical situation where it is defined not to matter?
- StreamBright 9y agoExactly this. I dont like when people try to sell new things even though my use case is perfectly fine with the older solution. I understand the security implications, yet there more to this topic than just security.
- ben0x539 9y agoBecause now people are carrying an MD5 implementation around with them, and when the next vaguely-hash-shaped problem comes up, they're gonna reach for that without really evaluating, b/c they've used it before so and it's at the top of their mental cache and it's even more convenient now. :/ I guess it's not entirely equivalent but I'm still sorta reeling from a "why should we introduce [something like bcrypt] for password storage when we already have these other perfectly fine hash functions in use in our codebase" convo at a previous project.
- andrewflnr 9y agoA situation where it is defined not to matter is unrealistic. Things you don't think are "security critical" have a tendency to unexpectedly become so; at least that's my impression. Why not use a more secure algorithm?
- JoachimS 9y agoNo No No. Then you add another dependency on MD5. And MD5 is a very slow, complex hash function. Use MurMur, City or any of a number of really fast, non secure hash functions instead.
- takeda 9y agoMake sure it can easily be replaced if needed though. I also use it in contexts where I need some consistent "randomization" (like your hash ring). The thing is that even though security might not be an issue in your application, you might discover in the future that it is. For example python dict relies on hash table to store key-values, doesn't seem like something that would be concerning (you're not encrypting or keeping anything secret), but python applications then started being targeted by collision attacks. The attacks' goal was to insert many elements that hashed to the same value, which caused DoS. Their solution though was to use salt value which is different on every run. The point is that something that might not seem like a security issue might turn out to be later on. It doesn't necessary mean we should always strong cryptographic hash functions (in many cases they might be too expensive) but at least write code in such way that we can easily replace it with something else if we need to.
- JoachimS 9y agoThen you are using a _very_ slow hash function for which there are many algorithms better than MD5.