Module: Imagemaster3000::Verification::Hash
- Defined in:
- lib/imagemaster3000/verification/hash.rb
Instance Method Summary collapse
Instance Method Details
#verify_hash! ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/imagemaster3000/verification/hash.rb', line 4 def verify_hash! logger.debug 'Verifying checksum' checksum = find_checksum! computed_checksum = verification[:hash][:function].file(file).hexdigest if checksum == computed_checksum verification[:hash][:checksum] = ::Digest::SHA512.file(file).hexdigest return end raise Imagemaster3000::Errors::VerificationError, "Checksum mismatch for file #{file}: expected: #{checksum}, was: #{computed_checksum}" end |