You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/lib/trustie/utils.rb

21 lines
382 B

#coding=utf-8
module Trustie
module Utils
def self.digest(diskfile)
md5 = Digest::MD5.new
File.open(diskfile, "rb") do |f|
buffer = ""
while (buffer = f.read(8192))
md5.update(buffer)
end
end
md5.hexdigest
end
end
end
if __FILE__ == $0
puts Trustie::Utils.digest('/Users/guange/Downloads/QQ_V4.0.2.dmg')
end