4 def self.const_missing(name)
6 when :SHA256, :SHA384, :SHA512
9 lib = File.join('digest', name.to_s.downcase)
15 raise LoadError, "library not found for class Digest::#{name} -- #{lib}", caller(1)
17 unless Digest.const_defined?(name)
18 raise NameError, "uninitialized constant Digest::#{name}", caller(1)
20 Digest.const_get(name)
24 # creates a digest object and reads a given file, _name_.
26 # p Digest::SHA256.file("X11R6.8.2-src.tar.bz2").hexdigest
27 # # => "f02e3c85572dc9ad7cb77c2a638e3be24cc1b5bea9fdbb0b0299c9668475c534"
34 # updates the digest with the contents of a given file _name_ and
37 File.open(name, "rb") {|f|
39 while f.read(16384, buf)
49 Digest.const_get(name)