Re: [PHP-DEV] Random string generation (á la password_make_salt)

2012-07-17 Thread Alex Aulbach
2012/7/17 Ángel González : > Those could be in the flag. The / are not really needed, they are an > additional syntax over regex provided by PHP (and the character can be a > different makes it a little bit like Perl. I see this as a "standard". So for me a regex is with delimiters, even if the l

Re: [PHP-DEV] Random string generation (á la password_make_salt)

2012-07-17 Thread Ángel González
On 17/07/12 13:34, Alex Aulbach wrote: >> That's more or less what I have thought. >> If it's a string surrounded by square brackets, it's a character class, >> else >> treat as a literal list of characters. >> ] and - can be provided with the old trick of provide "] as first >> character", >> "mak

Re: [PHP-DEV] Random string generation (á la password_make_salt)

2012-07-17 Thread Alex Aulbach
2012/7/16 Ángel González : >> 1a) If you want to support character classes, you can do it with pcre: >> http://www.php.net/manual/en/regexp.reference.character-classes.php > That's more or less what I have thought. > If it's a string surrounded by square brackets, it's a character class, > else >

Re: [PHP-DEV] Random string generation (á la password_make_salt)

2012-07-17 Thread Pierre Joye
hi, On Mon, Jul 16, 2012 at 10:19 PM, Ángel González wrote: > About supporting POSIX classes, that could be cool. But you then need a way > to enumerate them. Note that isalpha() will be provided by the C > library, so you > can't count on having its data. It's possible that PCRE, which we bundl

Re: [PHP-DEV] Random string generation (á la password_make_salt)

2012-07-16 Thread Ángel González
On 16/07/12 17:32, Alex Aulbach wrote: > I like it. I've looked in some code and found about 8 > password-generation-functions. 4 of them have more or less the same > idea behind. > > The rest generates more complicated password. E.g. "minimum one > digit", "First letter must be alphabetic". This i

Re: [PHP-DEV] Random string generation (á la password_make_salt)

2012-07-16 Thread Andrew Faulds
On 16 July 2012 16:32, Alex Aulbach wrote: > I like it. I've looked in some code and found about 8 > password-generation-functions. 4 of them have more or less the same > idea behind. > > The rest generates more complicated password. E.g. "minimum one > digit", "First letter must be alphabetic". T

Re: [PHP-DEV] Random string generation (á la password_make_salt)

2012-07-16 Thread Alex Aulbach
I like it. I've looked in some code and found about 8 password-generation-functions. 4 of them have more or less the same idea behind. The rest generates more complicated password. E.g. "minimum one digit", "First letter must be alphabetic". This is easy to implement. Some generate passwords from

Re: [PHP-DEV] Random string generation (á la password_make_salt)

2012-07-16 Thread Ángel González
On 16/07/12 16:21, Anthony Ferrara wrote: > If this is something that's desired, I can update the password > implementation to include this change (since it depends on a function like > this internally)... > > Anthony Looks good. -- PHP Internals - PHP Runtime Development Mailing List To unsubsc

Re: [PHP-DEV] Random string generation (á la password_make_salt)

2012-07-16 Thread Anthony Ferrara
I like the concept in principle. But implementing it is non trivial. First, you need a base-conversion function that will allow you to convert between arbitrary bases (base_convert() won't work, because it only works on fixed bases, and on numbers < INT_MAX)... Here's a utility class that does jus

Re: [PHP-DEV] Random string generation (á la password_make_salt)

2012-07-16 Thread Andrew Faulds
This sounds very useful. To make it easier to use, why not also add some string constants, something like CHARS_HEX, CHARS_BASE64, CHARS_DECIMAL, etc? Then you could just do `random_string(24, CHARS_HEX);` to get a 24-char hex string. On 16 July 2012 14:54, Nikita Popov wrote: > Hi all, > > I jus

[PHP-DEV] Random string generation (á la password_make_salt)

2012-07-16 Thread Nikita Popov
Hi all, I just want to throw a quick thought in here: The password API proposal includes a function called password_make_salt(), that basically creates a random string, either in raw binary form, or in the bcrypt salt format. Personally I don't see much use for the function in the salt context as