Sha256: 32f64967c1899e918bd2a2206acacebcf0ccebde98cc40f6a5828d6090019812

Contents?: true

Size: 667 Bytes

Versions: 1

Compression:

Stored size: 667 Bytes

Contents

require 'digest/sha1'
require 'digest/sha2'
require 'rickshaw/version'
require 'core_ext/string/to_sha1'
require 'core_ext/string/to_sha256'

module Rickshaw
  module SHA1
    def self.hash(file_path)
      hash = Digest::SHA1.new
      open(file_path, 'r') do |io|
        until io.eof?
          buffer = io.read(1024)
          hash.update(buffer)
        end
      end
      hash.hexdigest
    end
  end

  module SHA256
    def self.hash(file_path)
      hash = Digest::SHA256.new
      open(file_path, 'r') do |io|
        until io.eof?
          buffer = io.read(1024)
          hash.update(buffer)
        end
      end
      hash.hexdigest
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rickshaw-0.1.0 lib/rickshaw.rb