Module: HashVerify
- Included in:
- DocIntegrityCheck
- Defined in:
- lib/hash_verify.rb
Instance Method Summary collapse
-
#hash_file(encrypted_file_obj) ⇒ Object
Hash file object.
-
#hash_verified?(file_details) ⇒ Boolean
Verify the hash to a file.
Instance Method Details
#hash_file(encrypted_file_obj) ⇒ Object
Hash file object
6 7 8 |
# File 'lib/hash_verify.rb', line 6 def hash_file(encrypted_file_obj) Digest::SHA256.hexdigest(encrypted_file_obj.to_s) end |
#hash_verified?(file_details) ⇒ Boolean
Verify the hash to a file
11 12 13 14 15 |
# File 'lib/hash_verify.rb', line 11 def hash_verified?(file_details) hash = file_details["file_hash"] rechecked_hash = hash_file(file_details[:encrypted_text]) return hash == rechecked_hash end |