note 33254 deleted from function.uniqid by wez

From: Date: Sat, 30 Apr 2005 13:59:22 +0000
Subject: note 33254 deleted from function.uniqid by wez
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-88792@lists.php.net to get a copy of this message
Note Submitter: jphelps at diespammernotreached dot net ---- I have ported libuuid(3), which provides unique identifiers for C programs on Linux, to PHP. libuuid uses /dev/urandom as a source of random data. If /dev/urandom isn't available, the returned value is based on the current time and on data generated with the mt_rand() function (which in turn is seeded with the current time, PID, and UID). The C version is part of the e2fsprogs package. The number it generates is 128 bits long. The PHP version can be downloaded at: http://www.notreached.net/php-uuid-1.23.tar.gz In your code, write: <?php require_once('uuid.php'); // Returns a binary format $unique_id = uuid_generate(); // Two ways two make it a 7-bit string usable in a cookie: // 36-byte hyphenated, hexadecimal format compatible with // the OSF Distributed Computing Environment utility 'uuidgen': $osf_dce_format = uuid_unparse($unique_id); // Base64 encoded. 24 bytes. $base64 = base64_encode($unique_id); ?>

« previous php.notes (#88792) next »