Issue
I am working on a Yii app that requires the 'users' table to have a column 'token' that will need to be a unique random string that is based upon that user in the table (eg there will never be the same token twice).
Can anyone give me some tips on doing this, or are there a Yii component/extension/generator already setup to do this.
Also - what is the most optimised db column type for this?
Solution
I suggest just to use hash, that produces long string and use some very unique string to be hashed:
sha512($userName.time().rand(1000, 9999));
Some PHP hash algorithms lengths
Answered By - Justinas
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.