Commit 43d0e5e4 authored by Jacob Schatz's avatar Jacob Schatz Committed by Micaël Bergeron

Does HMAC SHA256 with secret instead of sans secret.

parent 29761e09
...@@ -635,8 +635,6 @@ tables: ...@@ -635,8 +635,6 @@ tables:
- last_update_started_at - last_update_started_at
- last_update_scheduled_at - last_update_scheduled_at
- next_execution_timestamp - next_execution_timestamp
- created_at
- updated_at
pseudo: pseudo:
- id - id
- project_id - project_id
......
require 'OpenSSL'
require 'digest' require 'digest'
require 'csv' require 'csv'
require 'yaml' require 'yaml'
...@@ -15,7 +16,8 @@ module Pseudonymity ...@@ -15,7 +16,8 @@ module Pseudonymity
Enumerator.new do | yielder | Enumerator.new do | yielder |
results.each do |result| results.each do |result|
to_filter.each do |field| to_filter.each do |field|
result[field] = Digest::SHA2.new(256).hexdigest(result[field]) unless result[field].nil? secret = Rails.application.secrets[:secret_key_base]
result[field] = OpenSSL::HMAC.hexdigest('SHA256', secret, result[field]) unless result[field].nil?
end end
yielder << result yielder << result
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment