This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Generate a secure random password in the the "Base32" alphabet | |
// Uses openssl secure random function for RNG generation | |
// Because the set of characters has 32 = 2^5 distinct values, characters can be | |
// easily selected, without bias (i.e. each character has the same chance | |
// of being selected), by using 5 bits of randomness per character. | |
// Note: strlen(base32_alphabet) MUST be exactly 2^bits_per_value |
NewerOlder