class Hello::Encryptors::Simple

Public Instance Methods

encrypt(s) click to toggle source
# File lib/hello/encryptors/simple.rb, line 18
def encrypt(s)
  Digest::MD5.hexdigest(s)
end
match(string, token) click to toggle source
# File lib/hello/encryptors/simple.rb, line 22
def match(string, token)
  encrypt(string) == token
end
pair(complexity = 8) click to toggle source
# File lib/hello/encryptors/simple.rb, line 13
def pair(complexity = 8)
  s = single(complexity)
  [s, encrypt(s)]
end
single(complexity = 8) click to toggle source

probability = 1 / ((8*2) ** (8*2))

# File lib/hello/encryptors/simple.rb, line 9
def single(complexity = 8)
  SecureRandom.hex(complexity)
end