Jump to content

Best way to generate 50~150 character long key


Mudsaf

Recommended Posts

Hello, i'm wondering which is best method to make account recovery key? Wondering is MD5 with random integer from 1-100k + some text there be good?

Link to comment
Share on other sites

Probably using an alphabet and a random set of characters.

function generate_key($key_length, $alphabet) {    $limit= strlen(alphabet) - 1;    $key = '';    for($i =  0; $i < key_length; $i++) {        $key .= $alphabet[mt_rand(0, $limit)];    }return $key;}// Generate the key with a particular alphabet$len = 150;$a= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'generate_key($len, $a);
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...