Module: Authlogic::Random
Overview
Handles generating random strings. If SecureRandom is installed it will default to this and use it instead. SecureRandom comes with ActiveSupport. So if you are using this in a rails app you should have this library.
Constant Summary collapse
- SecureRandom =
(::SecureRandom) ? ::SecureRandom : ActiveSupport::SecureRandom)
Instance Method Summary collapse
Instance Method Details
#friendly_token ⇒ Object
13 14 15 16 |
# File 'lib/authlogic/random.rb', line 13 def friendly_token # use base64url as defined by RFC4648 SecureRandom.base64(15).tr('+/=', '').strip.delete("\n") end |
#hex_token ⇒ Object
9 10 11 |
# File 'lib/authlogic/random.rb', line 9 def hex_token SecureRandom.hex(64) end |