Sha256: 421963c38c0ecf707e9e1250500094c8b2e3abf0e3dac3da42eb4bca8d2e9d52
Contents?: true
Size: 660 Bytes
Versions: 10
Compression:
Stored size: 660 Bytes
Contents
module Unidom::Common::Concerns::Sha256Digester extend ActiveSupport::Concern included do |includer| def digest(message, pepper: nil) self.class.digest message, pepper: pepper end def hex_digest(message, pepper: nil) self.class.hex_digest message, pepper: pepper end end module ClassMethods def digest(message, pepper: nil) message.present? ? Digest::SHA256.digest("#{message}_#{Rails.application.secrets[:secret_key_base]}_#{pepper}") : nil end def hex_digest(message, pepper: nil) message.present? ? Unidom::Common::Numeration.hex(digest(message, pepper: pepper)) : nil end end end
Version data entries
10 entries across 10 versions & 1 rubygems