Re: Random Numbers/Letters
От | Jeff Fitzmyers |
---|---|
Тема | Re: Random Numbers/Letters |
Дата | |
Msg-id | 80FEA902-3778-11D6-8101-0003938387F4@yahoo.com обсуждение исходный текст |
Ответ на | Random Numbers/Letters ("Hillensbeck, Preston" <PHillensbeck@sfbcic.com>) |
Список | pgsql-general |
> I need to find a way to generate random numbers and > letters together I m no crytpo expert, but here is a php function I am toying with. The reason I add the 200 characters is because I read somewhere that md5 'produces more random results' if it has a chunk to crunch. Maybe it is inefficient, insecure or doesn't really add anything?? <? // generate a random string function rand_string() { list($usec,$sec) = explode(" ", microtime()); mt_srand($sec * $usec); $rand = mt_rand(); $start = mt_rand(1,198); $length = mt_rand(1,198); // change these 400 characters often $text ='q54SMqa54VBPMqa54L3zxDKGzxs3zxswedWbbikplwlx GAZX5Fy9hy7uMqn!aWE&ujNmaCVBPMqa54L3swedYeappCVBLd9c vt9gbF!SazxsFDSagfHvt9gbFDSazMqKIF4cvxeEDh7ewSSKJTYe dJMa5K54SWkGB3zxXCVazxsw989A5xswDS5FDS8nplavswAZXRC9 84cvfrTYeda5KJHG4Guv3321QN764r6yweswAZXR298lcvfraCxs FDSaa5KJHG4321QN765Fz9hy7uMqnyaWEmitpl4MqvfhjcvytMzx sw477as98j587UIJHqfrJHggrCVBLd9cjkGBMzxsw4ua52wm98j5 87UIJHqfrJHkjsNmAZzxDKGzxs7uj7ewr54AZXCVaz'; $text = substr($text, $start, $length); $rand_s = md5($rand . $text); return $rand_s; }
В списке pgsql-general по дате отправления: