create_new_id()
private
Create a new session id.
The session id is an MD5 hash based upon the time, a random number, and a
constant string. This routine is used internally for automatically
generated session ids.
Show source
def create_new_id
require 'securerandom'
begin
session_id = SecureRandom.hex(16)
rescue NotImplementedError
require 'digest/md5'
md5 = Digest::MD5::new
now = Time::now
md5.update(now.to_s)
md5.update(String(now.usec))
md5.update(String(rand(0)))
md5.update(String($$))
md5.update('foobar')
session_id = md5.hexdigest
end
session_id
end