Jean Boussier
|
557fa38915
|
[rubygems/rubygems] Fix Bundler::Digest#sha1 on big-endian systems
As noticed by @nobu https://github.com/rubygems/rubygems/pull/4989#discussion_r735674633
From wikipedia: https://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode
> append ml, the original message length in bits, as a 64-bit big-endian integer.
`Q` is native endian, so little-endian on most modern hardware.
The original code from RubyDigest reverses the bytes:
d15f906caf/lib/ruby_digest.rb (L521)
But that makes the code non-portable, the correct way is to directly ask
for a big-endian representation.
https://github.com/rubygems/rubygems/commit/ba2be01ea4
|
2021-10-26 01:51:05 +09:00 |
|