Skip to content

Instantly share code, notes, and snippets.

@hakanensari
Created August 5, 2013 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakanensari/6152873 to your computer and use it in GitHub Desktop.
Save hakanensari/6152873 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby -w
require 'digest/md5'
filename = 'MD5.rdoc'
all_digest = Digest::MD5.hexdigest(File.read(filename))
incr_digest = Digest::MD5.new()
file = File.open(filename, 'r')
file.each_line do |line|
incr_digest << line
end
puts incr_digest.hexdigest
puts all_digest
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment