Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

Digest::Class.file

file(name, *args)

Creates a digest object and reads a given file, name. Optional arguments are passed to the constructor of the digest class.

Example
p Digest::SHA256.file("X11R6.8.2-src.tar.bz2").hexdigest
# => "f02e3c85572dc9ad7cb77c2a638e3be24cc1b5bea9fdbb0b0299c9668475c534"
See also .digest .hexdigest .bubblebabble also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0