Module: DoorCode
- Defined in:
- lib/door_code/restricted_access.rb
Defined Under Namespace
Classes: RestrictedAccess
Class Method Summary collapse
-
.generate_random_salt ⇒ Object
Generate a random salt for the encryption.
-
.salt ⇒ Object
Returns the salt or a random one.
Class Method Details
.generate_random_salt ⇒ Object
Generate a random salt for the encryption
11 12 13 14 |
# File 'lib/door_code/restricted_access.rb', line 11 def generate_random_salt o = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten string = (0..50).map{ o[rand(o.length)] }.join end |
.salt ⇒ Object
Returns the salt or a random one
6 7 8 |
# File 'lib/door_code/restricted_access.rb', line 6 def salt @salt ||= generate_random_salt end |