[TYPO3-core] RFC #8514: Feature: Add StdWrap feature "random Number/String"
Marcus Krause
marcus#exp2010 at t3sec.info
Thu Sep 9 20:16:25 CEST 2010
Hi!
Am 08.09.2010 09:40, schrieb Steffen Ritter:
> Hey list,
> This is an SVN patch request.
>
> Type: Feature
>
> Bugtracker references:
> http://bugs.typo3.org/view.php?id=8514
>
> Branches: trunk
>
> Problem:
> stdWrap lacks support for generating a random number between in a range
> or a random string/password.
Some background on "random numbers":
Java's Math.random(): float between 0 and 1
C++ rand(): integer between 0 and RAND_MAX (>= 32767)
Python's random.random(): float between 0 and 1
PHP's rand(): integer between 0 and (>=32768)
-> default minimum = 0
Key "number" is not descriptive! I'd favour keys integer & float.
Besides, t3lib_div::generateRandomBytes does not generate a string
usable for a "random password". It generates "byte"-sequences!
Generating a "random password" is a complex use case (character pools,
umlauts, character encodings). I'd focus on basics at first:
Integers, floats, hexstrings (see also t3lib_div::getRandomHexString()).
To comment Benjamin's comment in the bugtracker:
Having
stdWrap.hash = md5
is useless because you are not interested in a transformation (hashing
of an input) but only on the representation = a hex string
Thats why I mentioned hexstring instead of a hash key.
Marcus.
More information about the TYPO3-team-core
mailing list