Sha256: 93de685a06117574740c7d4dc2e8cd80bfe6fc5b7d5bdfb67bbe766346a55e6d
Contents?: true
Size: 847 Bytes
Versions: 7
Compression:
Stored size: 847 Bytes
Contents
# frozen_string_literal: true require "digest/md5" module Authlogic module CryptoProviders # A poor choice. There are known attacks against this algorithm. class MD5 class << self attr_accessor :join_token # The number of times to loop through the encryption. def stretches @stretches ||= 1 end attr_writer :stretches # Turns your raw password into a MD5 hash. def encrypt(*tokens) digest = tokens.flatten.join(join_token) stretches.times { digest = Digest::MD5.hexdigest(digest) } digest end # Does the crypted password match the tokens? Uses the same tokens that # were used to encrypt. def matches?(crypted, *tokens) encrypt(*tokens) == crypted end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems