Random Generation of Strings ... just randomly. Salty??

<?php $randoms = mt_rand(0, 999999); $random_string = sha1($randoms); /* or */ $randomy = file_get_contents('/dev/urandom', false, null, 0, 10); /* or */ $string_p = bin2hex($randoms); $numbered = current(unpack('L', $randoms)); /* or */ $randomly = mcrypt_create_iv(10, MCRYPT_DEV_URANDOM); /* or */ $salty = mcrypt_create_iv(10, MCRYPT_DEV_URANDOM); $salty = base64_encode($salty); $salty = str_replace('+', '.', $salty); $hasho = crypt('likeApassword', '$2y$10$' . $salty . '$');
So much randomness in this, that math is literally the fastest way to do it. I like HEX, but that's just because it doesn't make me spell past F. ;) Have fun!

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.