Sha256: ec68929727c9484972ffc156589cfb7b99f771277490540443b1edbd46241fd2
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
require 'digest/md5' require 'digest/sha1' require 'digest/sha2' require 'rickshaw/version' require 'core_ext/string/to_md5' require 'core_ext/string/to_sha1' require 'core_ext/string/to_sha256' require 'core_ext/string/to_sha512' require 'core_ext/string/to_base64' require 'core_ext/string/byte_packing' module Rickshaw module MD5 def self.hash(file_path) hash = Digest::MD5.new Rickshaw::Helper.hash_file(hash, file_path) end end module SHA1 def self.hash(file_path) hash = Digest::SHA1.new Rickshaw::Helper.hash_file(hash, file_path) end end module SHA256 def self.hash(file_path) hash = Digest::SHA256.new Rickshaw::Helper.hash_file(hash, file_path) end end module SHA512 def self.hash(file_path) hash = Digest::SHA512.new Rickshaw::Helper.hash_file(hash, file_path) end end module Helper def self.hash_file(hash, file_path) 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.5.0 | lib/rickshaw.rb |