Module: ROTP

Defined in:
lib/rotp.rb,
lib/rotp/otp.rb,
lib/rotp/totp.rb,
lib/rotp/hotp.rb

Defined Under Namespace

Classes: HOTP, OTP, TOTP

Constant Summary

BASE32 =
'abcdefghijklmnopqrstuvwxyz234567'

Class Method Summary (collapse)

Class Method Details

+ (Object) random_base32(length = 16)



10
11
12
13
14
15
# File 'lib/rotp.rb', line 10

def self.random_base32(length=16)
  b32 = ''
  OpenSSL::Random.random_bytes(length).each_byte do |b|
    BASE32[b % 32, 1]
  end
end