Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. idForURL = URI.escape((Base64.encode64(hash).strip))
  2.  
  3. require 'digest/sha1'
  4. print Digest::SHA1.hexdigest("Let's see how long this gets.")
  5. => b26316a2db52609f86b540de65282b9d367e085c
  6.  
  7. # app/models/secret.rb; this would go in the model you want to obfuscate
  8. class Secret < ActiveRecord::Base
  9. has_friendly_id :code, :use_slug => true
  10.  
  11. validates :name, :uniqueness => true
  12.  
  13. def code
  14. Digest::SHA1.hexdigest self.name
  15. end
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement