Class: Cfh::Hasher

Inherits:
Object
  • Object
show all
Defined in:
lib/cfh/hasher.rb

Overview

Hasher

Class Method Summary collapse

Class Method Details

.create(person_hash, key_value) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/cfh/hasher.rb', line 4

def self.create(person_hash, key_value)
  hash_key = hasher(person_hash)
  data = {
    key_value: key_value,
    hash_key: hash_key
  }
  hasher(data)
end

.hasher(data) ⇒ Object



13
14
15
16
# File 'lib/cfh/hasher.rb', line 13

def self.hasher(data)
  data_json = JSON.pretty_generate(data)
  Digest::SHA256.hexdigest(data_json)
end