Creates a digest of the TarEntry
entry from the digest
algorithm set by the security policy.
# File lib/rubygems/package.rb, line 278
def digest entry # :nodoc:
algorithms = if @checksums then
@checksums.keys
else
[Gem::Security::DIGEST_NAME].compact
end
algorithms.each do |algorithm|
digester =
if defined?(OpenSSL::Digest) then
OpenSSL::Digest.new algorithm
else
Digest.const_get(algorithm).new
end
digester << entry.read(16384) until entry.eof?
entry.rewind
@digests[algorithm][entry.full_name] = digester
end
@digests
end