Example security code:
a35sfj9ksdf
How can I ask a user for several characters (e.g. first, forth and ninth) of their security code and then check these? The main difficulty comes in how do I store the seucurity code in an encrypted form - if I were to store each character individually, then the encryption would be incredibly easy to break.
A possibility that was described neither here nor at How to store and verify digits chosen at random from a PIN/Password is this:
Now you have to store the manageable quantity of n+1 fields for a security code of length n and can still verify single (position,char) tuples
What about using substr()?
That would return 'a', the first character
This would return 4, the 5th character
So something like please enter the $n character and use
you can follow those steps,
store all your desired characters in an array
generate n (length of user code) number of random numbers where each number will represent a character of your array.
Then concat the new generated characters to make a string
Store the string using session and when ask from the user just match the user code with session
you can also make a simple captcha service using the similar way