views:

86

answers:

1

I want to generate a large (~2 kb), random, unique block of random text for use as an authentication token. Standard hashing functions produce results that are too short. Would it be OK to use openssl's private key generation function or is there more appropriate solution I should look at?

+5  A: 

I don't know why you would need such a large string, but you should use the openssl_random_pseudo_bytes function. It is generated with one of the strong encryption algorithms. That is about as random as you can get.

Byron Whitlock