Im using hash to create a random string.
hash('sha512', uniqid());
Will the hash contain only letters and numbers or will other characters be used? If so, how can I limit it so only letters and numbers are used?
Im using hash to create a random string.
hash('sha512', uniqid());
Will the hash contain only letters and numbers or will other characters be used? If so, how can I limit it so only letters and numbers are used?
The third argument to hash()
is $raw_output
. The manual has this to say about this argument:
raw_output
When set toTRUE
, outputs raw binary data.FALSE
outputs lowercase hexits.
While it may be a bit cryptic, "lowercase hexits" means lowercase hexadecimal notation. Hexadecimal notation uses the characters 0-9 and A-F.
So yes, the output will contain only letters and numbers.