Class: Hashed

Inherits:
Object
  • Object
show all
Defined in:
lib/encrypt_column/hashed.rb

Class Method Summary collapse

Class Method Details

.val(plaintext, salt = ENV['HASH_SALT']) ⇒ Object



4
5
6
7
8
# File 'lib/encrypt_column/hashed.rb', line 4

def self.val(plaintext, salt = ENV['HASH_SALT'])
  return nil if plaintext.nil?
  return raise 'Missing Hash Salt Config' if salt.nil?
  Digest::SHA2.hexdigest(salt + plaintext.to_s)
end