Module: Authtools::Common

Included in:
Password, Token
Defined in:
lib/authtools/common.rb

Instance Method Summary collapse

Instance Method Details

#saltObject

Generates a psuedo-random 64 character string.



5
6
7
8
9
# File 'lib/authtools/common.rb', line 5

def salt
  salt = ""
  64.times { salt << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }
  salt
end