Skip to content

Instantly share code, notes, and snippets.

@jpterry
Created May 23, 2014 18:14
Show Gist options
  • Save jpterry/7c80d6f60d9c9a45b319 to your computer and use it in GitHub Desktop.
Save jpterry/7c80d6f60d9c9a45b319 to your computer and use it in GitHub Desktop.
diff --git a/lib/token_generator.rb b/lib/token_generator.rb
index 8481154..4fe7527 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(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