Skip to content

Instantly share code, notes, and snippets.

@ssajous
Created December 6, 2014 20:59
Show Gist options
  • Save ssajous/0793bb41702169a1302d to your computer and use it in GitHub Desktop.
Save ssajous/0793bb41702169a1302d to your computer and use it in GitHub Desktop.
Calculate the MD5 hash of a file
#!/usr/bin/ruby
require 'digest/md5'
if ARGV[0] && File.exists?(ARGV[0])
STORAGE_PATH = ARGV[0]
else
puts 'Fatal error: path not existent or not given.'
exit
end
digest = Digest::MD5.file(STORAGE_PATH)
puts digest
@ssajous
Copy link
Author

ssajous commented Dec 6, 2014

Usage $ ./md5.rb file.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment