Module: Chef::Mixin::Checksum

Included in:
Client, Provider::File, Provider::Template
Defined in:
lib/chef/mixin/checksum.rb

Instance Method Summary collapse

Instance Method Details

#checksum(file) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/chef/mixin/checksum.rb', line 25

def checksum(file)
  digest = Digest::SHA256.new
  fh = ::File.open(file)
  fh.each do |line|
    digest.update(line)
  end
  fh.close
  digest.hexdigest
end