Skip to content

Commit

Permalink
Merge pull request #52 from sbc100/fix_openssl_random_usage
Browse files Browse the repository at this point in the history
Use SecureRandom rather than OpenSSL::Random
  • Loading branch information
mdp committed Apr 21, 2016
2 parents c73784e + daaaa11 commit 27a59b3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rotp.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'cgi'
require 'uri'
require 'openssl'
require 'securerandom'
require 'rotp/base32'
require 'rotp/otp'
require 'rotp/hotp'
Expand Down
2 changes: 1 addition & 1 deletion lib/rotp/base32.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def decode(str)

def random_base32(length=16)
b32 = String.new
OpenSSL::Random.random_bytes(length).each_byte do |b|
SecureRandom.random_bytes(length).each_byte do |b|
b32 << CHARS[b % 32]
end
b32
Expand Down

0 comments on commit 27a59b3

Please sign in to comment.