ChristopherNugent / Locksmith

A simple password generator applet for elementary OS
GNU General Public License v3.0
6 stars 4 forks source link

Using GLib.Random for passwords does not produce secure passwords #35

Open krisives opened 3 years ago

krisives commented 3 years ago

The problem is that it uses GLib.Random to do this. It’s a pseudo-random number generator (PRNG) and is not suitable for cryptographic purposes:

This PRNG is suitable for non-cryptographic use such as in games (shuffling a card deck, generating levels), generating data for a test suite, etc. If you need random data for cryptographic purposes, it is recommended to use platform-specific APIs such as /dev/random on UNIX, or CryptGenRandom() on Windows.

It’s seeded with a single uint32_t value, which depending on platforms and availability might be from /dev/random or might be the current time. It doesn’t really matter how well it’s seeded because at most there are pow(2, 32) unique passwords that can ever be generated with this.