lib/text/checkm/checksum.rb
# Compute the checksum 'alg' for a file
# @param [File] file
# @param [String] alg md5, sha1, sha256, dir
Compute the checksum 'alg' for a file
Compute the checksum ' alg ' for a file
def checksum(file, alg) 
        return true unless alg 
        return File.directory?(file) if alg =~ /dir/
        digest_alg = digest_for(alg)
        return false unless digest_alg 
        while !file.eof? && (chunk = file.readpartial(CHUNK_SIZE))
          digest_alg << chunk
        end
        digest_alg.hexdigest
      end
def checksum ( file , alg ) return true unless alg return File . directory? ( file ) if alg =~ / dir / digest_alg = digest_for ( alg ) return false unless digest_alg while ! file . eof? && ( chunk = file . readpartial ( CHUNK_SIZE ) ) digest_alg << chunk end digest_alg . hexdigest end
Compute the checksum 'alg' for a file
Compute the checksum ' alg ' for a file
# TODO: don't pass file handles around # TODO: something less counterintuitive # TODO: something less counterintuitive
file
<not_specific>
alg
<not_specific>
<not_specific>
None