Seeding with the current time is the real sin here.
Seeding with the current time is the real sin here.
If you generate long elaborate passwords then they can resist some of these flaws but the point is you don't want to introduce a flaw when they are simpler and better solutions out there.
Mistakes are natural, you want to provide the utmost resistance to such exploits which can stack up to become viable.
hiKxChDiaHNAtgVz
vis-à-vis: kähdikyylkönekkimahdakerttaksa
One is a 16 random `[a-zA-Z0-9]` characters, the other is a 32 character long nonce word, containing <ä> and <ö> among others that conforms to Finnish phonology, but otherwise is devoid of any meaning and phonology but easier to remember to speakers of Finnish.
One is a 16.Does 32 characters opposed to 16 offset that the latter conforms to the phonology of a language with 6 million speakers?
Psuedo-random is always better because anything else usually follows a pattern that can be exploited(sequence, structure, words, statistical bias)
If we can't make assumptions about the secret, the only solution is plain brute-force when it comes to the number of characters squared the length of the password.
It isn't a word and has no actual meaning or morphology; it's comparable to something such as:
wrockrangnattentamploozakoshal
It conforms to Finnish orthography and phonology, but otherwise not a word.So if it has some predictable structure, statistical attributes etc, it can be exploited to reduce the search space and therefore can be weaker than the actual raw entropy.
Does that matter in the real world? I don't think so.
I would assume that assuming an attacker knows that it is nonce Finnish, that he would be able to craft a specific algorithm that is faster than 32 random character for specifically this, but that in practice if he not know that with all modern approaches it is æquivalent to attempting to bruteforce 32 characters, giving priority to letters and vowels, especially with the inclusion of <ä> and <ö>.
the first option is rather simple, assuming we have a good psuedo-random generator with low bias margins. we get:
A-Z,a-z,0-9 = 58 options, Length = 16
58^16/2 is the target.
Second option is weaker IMO because we know that plain brute-force is rarely being used today for anything over 13~14 characters.
We mostly use masks\dictionaries to try common passwords, phrases, sequences. So even if there's a very small chance that someone would have some kind of heuristic rule that targets Finnish orthography\honology, it is still more likely than someone successfully brute-forcing 16 random chars+numbers.
Another interesting observation is that fact that it contains common English words by chance. things like rock or tent. those can increase the chance of a dictionary success(our 32 chars starts breaking apart) whereas the 16 chars are random so in nature there are less prone to contain common English words
I recently signed up for a ticketing website to buy tickets for a concert and was appalled that the site wouldn't accept my 50+ character generated password... I had to enter something between 8 and 15 characters.
Still seems to me that "^Zh7*2wNfRG7ehj" would still be inherently less secure than "thisisasuperlongpasswordandithas12345alotofcharactersinitthatwouldtake12345rainbowtablesalongtimetocalculatefor"
15 vs 111 characters to find permutations for.
That is, of course, even assuming that the password db for the site is even hashed (AND salted) or not.
Indeed, that is what I am wondering. If the double length offsets that it is not random.
Twice the length is quite a lot, but it's also not random any more.
What you are wondering about is the size of base of the exponentiation. Let's look into that.
If you use individual, unrelated letters, this is 26 (or 52 when you allow uppercase, or 62 if you also allow numbers). At e.g. 12 letter, this is 62 to the power of 12. At 16 letters, it is 62 to the 16.
If you use words (as the comic proposes), then the dictionary size will be the base (in this case, 4000 or so). You have fewer words, so entropy is 4000 to the 4.
If you use phonologically grouped words or syllables, the base size is their number. I'm not a linguist, but I'd guess it is somewhere around 100 or so. If a syllable is 2 to 3 letters long and you use 32 letters, you get something like 12 syllables. Entropy is 100 to the 12.
There are 36^16 possible passwords with the first scheme. I don't know how you generated the second. One way of doing it would be to generate all valid Finnish syllables and select randomly from that. If the number of possible syllables raised to the power of the number of syllables in your password is greater than 36^16, then it's more secure.
As somebody who only ever uses rng for games, and then indeed seeds with os.microtime(), what's the issue and what is a better approach?
The proper way to do this for cryptographic purposes is use the RNG facility provided by the kernel, which mixes in local entropy. Or go directly to the CPU like Intel’s RDRAND instruction. But the kernel should be using this if it’s enabled.
In terms of a global password manager, it's extremely bad, you now can use things like "member since x" to guess a password. If, for example, a database with credentials are leaked, you've significantly shorted the amount of passwords that need to be brute forced for a given target (assuming you know what password manager software they are using)
A good approach would have been something as simple as adding the master password into the seed. (Master password + time). An even better approach would be using a more cryptographically secure random number from the system for either the whole thing or at very least for the seed. (On linux systems /dev/random). You certainly could combine all those approaches to make the password much harder to guess.
See here for an online poker game which actually had this flaw: https://news.ycombinator.com/item?id=7207851
I had to generate a 20 char random key string in Rust the other day, I just wrote:
rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(20)
.map(char::from)
.collect()
There. Uniform, decent entropy, explicit, simple.For example, even assuming nanoseconds, that's only log(10^9) bits of entropy if you can guess what second (not that hard, may even be public). That's nowhere near enough.
I'd also doubt that many ways you try to get a nanosecond resolution time actually have that resolution, there's probably discrete steps of lower resolution.