Re: Future of Text_Password
| From: | Jon Parise | Date: | Sun, 30 Nov 2008 22:17:14 +0000 |
| Subject: | Re: Future of Text_Password | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-51192@lists.php.net to get a copy of this message | ||
On Sun, Nov 30, 2008 at 02:56:55PM +0100, Martin Jansen wrote:
> In the past it has become obvious to me that I have been using
> Text_Password for much more than just creating passwords. I basically
> used it everywhere where I needed to produce "nice looking" random
> string. That's why I think it is time for a new package Text_Random
> with the following features:
...
> * Hooks for making sure that generated strings are really unique.
> Often you might want to query a memcached instance or a database with
> the generated string to see if it isn't used in an existing record
> already. This could be realized by utilizing some sort of hooking
> infrastructure.
While this type of functionality is certainly useful, I don't think it
really belongs in a Text_Random package. Testing a generated key's
uniqueness is more the domain of an ID generator or a UUID package[1].
That's not to say that IDs cannot be generated randomly; rather,
randomly-generated strings need not have the restriction of being
unique, and the framework for verifying their uniqueness may fall
outside the bounds of Text_Random.
[1] http://www.python.org/doc/2.5.2/lib/module-uuid.html
--
Jon Parise (jon of php.net) :: The PHP Project (http://www.php.net/)