Skip to content

Instantly share code, notes, and snippets.

@jpterry
Created May 23, 2014 18:18
Show Gist options
  • Save jpterry/dedd9646c9e7b1432228 to your computer and use it in GitHub Desktop.
Save jpterry/dedd9646c9e7b1432228 to your computer and use it in GitHub Desktop.
diff --git a/lib/token_generator.rb b/lib/token_generator.rb
index 8481154..a80ca28 100644
--- a/lib/token_generator.rb
+++ b/lib/token_generator.rb
@@ -2,7 +2,6 @@
module TokenGenerator
def self.generate
- random_text = ([Time.now.to_f] + (1..10).map{rand}).join('--')
- ActiveSupport::Base64.encode64_url(Digest::SHA1.digest(random_text))
+ ActiveSupport::Base64.encode64_url(Digest::SHA1.digest(SecureRandom.random_bytes(32)))
end
-end
\ No newline at end of file
+end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment