Yes, I agree with previous recommendations, but I want to describe my way of session ID creation: I have the stored procedure in my db (PostgreSQL), which generates random text with length specified by argument and checks it's uniqueness against proper column of the session table. The first character could be
too. I guess that 10 characters is enough... No secret salt, no digest, but slightly slower when new session ID created.