I need to create 32 bytes unique identifier, just like libuuid from the ext2utils project (C library). I've found that there's a package that is a wrapper of libuuid, but i dont have permission to install any php module / package. so, is there any php script i can use?
You need something like this? <?php // better, difficult to guess $str = strtoupper(md5(uniqid(rand(), true))); $str = substr($str,0,8) . "-" . substr($str,8,4) . "-" . substr($str,12,4). "-" . substr($str,16,4). "-" . substr($str,20); echo $str; ?> Code (markup): from my dutch weblog : http://blog.ericbruggema.nl/2008/05/23/php-guid-maken/
If you are storing these for user or other identification, you should also verify that a newly generated one isn't currently being used. Although small, there is still a slight chance of having an id collision.