I’m generating a verification code to be used for account activation. You’ve probably seen this sort of thing before.
My question: if I were to generate this code with a complex formula like this:
md5(md5(time().'helloguys'.rand(0,9999)));
Is it really any better than generating just a random string of 32 characters and numbers like gj3dI3OGwo5Enf...?
No, using the hash is not better. It would be more secure (less predictable) to pick 32 random characters. (Digits are characters.) Use a good (“cryptographic”) random number generator, with a good seed (some bytes from /dev/random). Don’t use time as a seed.