Module: Utils::MD5

Defined in:
lib/utils/md5.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.buffer_sizeObject

Returns the value of attribute buffer_size.



6
7
8
# File 'lib/utils/md5.rb', line 6

def buffer_size
  @buffer_size
end

Class Method Details

.md5(filename) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/utils/md5.rb', line 12

def md5(filename)
  digest = Digest::MD5.new
  digest.reset
  File.open(filename, 'rb') do |f|
    until f.eof?
      digest << f.read(MD5.buffer_size)
    end
  end
  digest.hexdigest
end