Module: SecureRandom

Defined in:
lib/active_support/core_ext/securerandom.rb

Constant Summary collapse

BASE58_ALPHABET =
("0".."9").to_a + ("A".."Z").to_a + ("a".."z").to_a - ["0", "O", "I", "l"]
BASE36_ALPHABET =
("0".."9").to_a + ("a".."z").to_a

Class Method Summary collapse

Class Method Details

.base36(n = 16) ⇒ Object



45
46
47
# File 'lib/active_support/core_ext/securerandom.rb', line 45

def self.base36(n = 16)
  SecureRandom.alphanumeric(n, chars: BASE36_ALPHABET)
end

.base58(n = 16) ⇒ Object



20
21
22
# File 'lib/active_support/core_ext/securerandom.rb', line 20

def self.base58(n = 16)
  SecureRandom.alphanumeric(n, chars: BASE58_ALPHABET)
end