Added remote digest methods

This commit is contained in:
Stephen Haywood 2012-01-12 12:47:29 -05:00
parent 2e60d2e01a
commit 8d19bca2a9
1 changed files with 27 additions and 0 deletions

View File

@ -33,6 +33,15 @@ module File
end
end
#
# Returns a MD5 checksum of a given remote file
#
def file_remote_digestmd5(file2md5)
chksum = Digest::MD5.hexdigest(read_file(file2md5))
return chksum
end
#
# Returns a SHA1 checksum of a given local file
#
@ -47,6 +56,15 @@ module File
end
end
#
# Returns a SHA1 checksum of a given remote file
#
def file_remote_digestsha1(file2sha1)
chksum = Digest::SHA1.hexdigest(read_file(file2sha1))
return chksum
end
#
# Returns a SHA256 checksum of a given local file
#
@ -61,6 +79,15 @@ module File
end
end
#
# Returns a SHA2 checksum of a given remote file
#
def file_remote_digestsha2(file2sha2)
chksum = Digest::SHA256.hexdigest(read_file(file2sha2))
return chksum
end
#
# Platform-agnostic file read. Returns contents of remote file +file_name+
# as a String.