Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72026 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46138 invoked from network); 3 Feb 2014 01:14:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2014 01:14:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.44 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.215.44 mail-la0-f44.google.com Received: from [209.85.215.44] ([209.85.215.44:41531] helo=mail-la0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/17-30967-47DEEE25 for ; Sun, 02 Feb 2014 20:14:29 -0500 Received: by mail-la0-f44.google.com with SMTP id hr13so1278666lab.3 for ; Sun, 02 Feb 2014 17:14:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=HpHU9MH6WU3OzjJUrKOkUq+MHjEET7/FsKQlRXj1eGE=; b=ITD6eNoXRF//iONTbLt8eIUQdLVVcMhGnRgVdqTyAe9NhjoykkkNBldX7Iw/ifq5EB DNfevHGw29gQeUWqutx0U3WtYZi4yZM7IGQ1bsmFM8qnIZ0y6q9wJ1uUQk44gnjREyoT 9rU5tXt1nNShj5txFmVh4brTMNUVVhQh00nHAWWgHcpJcDlM1Uodq9QNaqDhuFY5fdGZ 51MFQBaOehwF3H4+O0106KqvtMz5xYvcE4mYndNDOGe4q/oKQqA8Au3cUUcz8CZSqoIw hAih3tDRCA5X4bOwIZgo6R4bjw9SWSByJVH/lz5L4OZ8E/es5hugSHOn6gQE691MXHck kz9g== X-Received: by 10.112.158.131 with SMTP id wu3mr22053382lbb.6.1391390065310; Sun, 02 Feb 2014 17:14:25 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.199.37 with HTTP; Sun, 2 Feb 2014 17:13:45 -0800 (PST) In-Reply-To: References: <52EDF552.4010208@divbyzero.net> Date: Mon, 3 Feb 2014 10:13:45 +0900 X-Google-Sender-Auth: 7PiYS3oYq8CNZNki8yYZPSewVoc Message-ID: To: Tjerk Meesters Cc: Martin Jansen , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c37b32963fc904f1763e6d Subject: Re: [PHP-DEV] Extending uniqid() or not? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c37b32963fc904f1763e6d Content-Type: text/plain; charset=UTF-8 Hi Tjerk, On Mon, Feb 3, 2014 at 8:55 AM, Tjerk Meesters wrote: > I think it would be good enough to have only uuid v4: > > function uuidv4() > { > $data = openssl_random_pseudo_bytes(16); // or whatever > > $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0010 > $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 > > return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); > } > > It's really just a representation of random data, whereby 6 bits are used > for the actual format. > I agree. UUID v4 simply generate random ID and it is good for many purposes. My concern is portability. OpenSSL(or Mcrypt) is provided as module. Users tends not to use module functions whenever possible. To address this issue, OpenSSL could be a module compiled by default. Security matters for all applications. Compiling OpenSSL by default would be nice to have. Any comments? -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11c37b32963fc904f1763e6d--