Ruby: how to get the MD5 hash of a file
This post was last updated for Ruby 3.1.2.
To compute the MD5 hash of a file in Ruby, use
require "digest" Digest::MD5.file("my_file.txt").hexdigest # => "272946d082eb5758a2bcbdaa2203bc8c"
Digest::Class.file, the base class for
It took me awhile to find this, so hopefully I’ve saved you some time!