Let's say I have a character set. Let's say I'm using PHP.
$charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" . "abcdefghijklmnopqrstuvwxyz" . "0123456789" . "!@#$%^&*()_+-=";
If I build a string from a static character set, using cryptographic randomness...is the resulting password cryptographically random? I'm not 100% sure I'm even asking the right question here. Is this practical?
$pw = "";
for($i=0; $i<16; $i++){
$pw .= $charset[random_int(0, iconv_strlen($charset)-1)];
}
echo $pw;
I think the answer is no, right? I think the best practice way to do something like this is to first start off with a random character space (drawn from a source with high enough entropy) and then use a PRNG to get random indexes like I'm doing...?
Thanks.