summaryrefslogtreecommitdiff
path: root/lib/rubygems
diff options
context:
space:
mode:
authorMau Magnaguagno <maumagnaguagno@gmail.com>2023-03-16 13:31:40 -0300
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-23 17:18:49 +0900
commit069640d3558022913ef164e2b73ef477b8f89a79 (patch)
treef3e03fbc64ee0cc63781546bf6cf150c6efed927 /lib/rubygems
parenta9fd1860dd30fff3b6e5ad0d65801f8188019325 (diff)
Avoid intermediate array in TarHeader#calculate_checksum
String#sum(0) sums the character bytes without a modulo. Follow-up of #6476 based on comment from @nobu.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7582
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/package/tar_header.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/rubygems/package/tar_header.rb b/lib/rubygems/package/tar_header.rb
index 06e0cbd5a4..0bec8f4845 100644
--- a/lib/rubygems/package/tar_header.rb
+++ b/lib/rubygems/package/tar_header.rb
@@ -211,7 +211,7 @@ class Gem::Package::TarHeader
private
def calculate_checksum(header)
- header.bytes.sum
+ header.sum(0)
end
def header(checksum = @checksum)