1

1) If one iteration of MD5 takes x seconds, is it safe to assume that n iterations of MD5 takes n * x seconds?

2) Will salted and unsalted versions of md5 hash algorithms take approximately the same amount of time to compute?

Sjoerd
  • 30,589
  • 13
  • 80
  • 107
user9355495
  • 265
  • 3
  • 6
  • 4
    MD5 is severely broken. If you're asking this for any reason other than pure curiosity, then answers will likely give you false confidence in whatever you're trying to do. – Joseph Sible-Reinstate Monica Mar 11 '19 at 01:50
  • 2
  • Iterations mean multiple runs. And of course it will take N times as much time if you run it N times. 2) The amount MD5 takes depends on the amount of input not if the input is salted or not, i.e. 1000 bytes with no salted takes more time than 100 bytes with a 100 byte salt (i.e. 200 bytes input). - Anyway, it is not clear what this question has to do with security since you don't provide any context. If you ask about password hashing please don't use a simple hash like MD5, see How to securely hash passwords? instead.
  • – Steffen Ullrich Mar 11 '19 at 06:04
  • 1
    @JosephSible: MD5 is not broken in general the same way as CRC is not broken in general. These are just algorithms which are unsuitable for specific use cases. It is not fully clear what exact use case this is but it looks like password storage. In this use case a simple MD5 was never suitable but sufficient rounds of MD5 (to be slow enough) with proper salting (to be resistent against rainbow tables) would still be sufficient (although there are much better solutions - don't roll your own) since the collision resistance problem of MD5 does not matter here. – Steffen Ullrich Mar 11 '19 at 06:11
  • MD5 time depends of the amount of data that is being MD5'ed. To MD5 a small document it's an instant procedure, to do it for a movie, you actually have to read the whole file which takes a lot more. – Overmind Mar 11 '19 at 06:34
  • It would be helpful if you provide some context. Are you using MD5 for passwords? Are you worried about performance? Do you want a fast or slow hash function? – Sjoerd Mar 11 '19 at 09:25