module HashVerify
Public Instance Methods
hash_file(encrypted_file_obj)
click to toggle source
Hash file object
# 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)
click to toggle source
Verify the hash to a file
# 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