Sha256: e69e9c197cb567deab0827fb729d92736cf9512d383c25b1a63cad51b4866d84

Contents?: true

Size: 812 Bytes

Versions: 2

Compression:

Stored size: 812 Bytes

Contents

module Puppet::Util::Checksums
    def md5(content)
        require 'digest/md5'
        Digest::MD5.hexdigest(content)
    end

    def md5_file(filename)
        require 'digest/md5'

        incr_digest = Digest::MD5.new()
        File.open(filename, 'r') do |file|
            file.each_line do |line|
                incr_digest << line
            end
        end

        return incr_digest.hexdigest
    end

    def sha1(content)
        require 'digest/sha1'
        Digest::SHA1.hexdigest(content)
    end

    def sha1_file(filename)
        require 'digest/sha1'

        incr_digest = Digest::SHA1.new()
        File.open(filename, 'r') do |file|
            file.each_line do |line|
                incr_digest << line
            end
        end

        return incr_digest.hexdigest
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-0.24.0 lib/puppet/util/checksums.rb
puppet-0.24.1 lib/puppet/util/checksums.rb