Created
August 2, 2016 06:45
-
-
Save ravenberg/a94ca4faee9f2b45c82eaa6b4b3ddcd9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_hash(name) | |
readsize = 64 * 1024 | |
File.open(name, 'rb') do |f| | |
size = File.size?(name) | |
data = f.read(readsize) | |
f.seek(-readsize, IO::SEEK_END) | |
data += f.read(readsize) | |
return Digest::MD5.hexdigest(data) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment