5 ms·
head may read an awful lot from /dev/urandom before it exits. ;-) And md5sum would limit my password to 0-9a-f whereas with tr(1) I get to choose the characte
by ralph 18y ago
head may read an awful lot from /dev/urandom before it exits. ;-) And md5sum would limit my password to 0-9a-f whereas with tr(1) I get to choose the character set.
- tptacek 18y agoMD5 is giving you a 128 bit random number. That's an AES key. The character set isn't going to make the password weak.
- zain 18y agoOf course it will, since the password is stored as a string. It may be a random set of 0-9a-f, but a brute force attack will still only need to use those characters. Compare that to a password of the same character length using any possible characters and you can see that it is clearly weaker.
- tptacek 18y agoYou need to re-read Shannon. The information content of a 128 bit random integer encoded in 32 alphanumeric characters is 128 bits. You cannot feasibly brute-force a 128 bit random number: if you could guess 1000 times per second, it would take you 323708492124180425669115874649 years. [edit: i got ((((((2^128)/1000)/60)/24)/365)/2) wrong the first time]
- zain 18y agoI understand that. I'm not disputing the fact that a 128 bit random integer is hard to guess. The problem, however, is that it is being stored as a string. As such, if you decide to use the 32 character hex representation as a password, you're essentially storing a 32 character string that can only consist of 0-9a-f. A random 32 character alphanumeric string would correspond to a random integer much larger than 128 bits, and as such, would be much stronger. There's no benefit to go with a weaker password.
- tptacek 18y agoNo offense, but I think this argument is pretty silly. "dd" off 16 bytes from /dev/urandom and base64 it. You win; you just saved 7 characters.
- ralph 18y agoYou used `md5' in your pipeline, I assumed you meant md5sum(1) as I'm not aware of an md5 command. md5sum gives a 32 character string that's the 128-bit MD5 digest in hex. Therefore it uses only characters 0-9a-f making the password weaker. I'm sorry that you find this criticism "silly" but others reading your pipeline may not, like you, realise its flaw, you got an upvote after all, and use it.
- tptacek 18y agoOn my Mac, it's just "md5". There's no "flaw" in a 128 bit random password. You use the word "weaker" as if to mean "not unbreakable", though "unbreakable" is what it is.
- ralph 18y agoYou're assuming a limit on password length won't apply. In that case, I may as well print it in binary and just have 0 and 1 ASCII characters in my password.