I\'m making a table in a MySQL database to save some session data, including session_id. What should be the length of the VARCHAR to store the
@sachleen answer isn't full.
More detailed info about session id length is described here.
Summary:
128-bit digest (MD5)
4 bits/char: 32 char SID
5 bits/char: 26 char SID
6 bits/char: 22 char SID
160-bit digest (SHA-1)
4 bits/char: 40 char SID
5 bits/char: 32 char SID
6 bits/char: 27 char SID
And sample regex to check session id:
preg_match('/^[a-zA-Z0-9,-]{22,40}$/', $sessionId)