Archive for July 2009
17
PHP – Generate/Create strong passwords, uuid, random string
0 Comments | Posted by Brian M McGarvie in PHP
>edfa often the need to create passwords or some other ‘unique’ string be it a captcha or for use as unique identifier (UUID).
Here are a few functions I’ve used and refined over the years, 2 types, for password/random string generation and UUID generation.
Generating random strings is pretty simple as it’ll be a password.
However for a UUID there is always the slim chance it’s not unique.
If you are a professional developer (or aspiring) you will inevitably get asked to customise or even better “extend” existing wares.
If it’s a product you are familiar with great! If not I heartilly reccomend spending a little time investigating prior to accepting a job ( ultimatley if they are happy to give
access to their code, if not atleast tell you what’s been used so you cam repliocate it to play with briefly). I know this sounds like a lot of work wich ultimatley – if you
don’t accept the job – you have done for free, but it will save you masses of grief, tears and late nights if you do.
So, I have a few pointers to ‘be aware of’ while evaluating the job and to (generally) identify crappy PHP products/solutions quickly…