Module: OAuth2::Utils

Defined in:
lib/oauth20/utils.rb

Class Method Summary collapse

Class Method Details

.generate_key(length = 16) ⇒ Object

Generate new SHA1 encoded key with a given length.

Parameters:

  • Length (String)

    of the key to generate.



8
9
10
# File 'lib/oauth20/utils.rb', line 8

def self.generate_key(length = 16)
  Digest::SHA1.hexdigest(Time.now.to_s + rand(12341234).to_s)[1..length]
end