diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2021-10-25 17:02:42 +0200 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2021-10-26 01:51:05 +0900 |
| commit | 557fa389155810f38f111c00a649c313a639dbb5 (patch) | |
| tree | e3bddf2cdef57ae6721786a810500691ff8bb5fc /include/ruby.h | |
| parent | 244c98e635a01cc7cfde9e24ed4b44413e6c3e75 (diff) | |
[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:
https://github.com/Solistra/ruby-digest/blob/d15f906caf09171f897efc74645c9e31373d7fd1/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
Diffstat (limited to 'include/ruby.h')
0 files changed, 0 insertions, 0 deletions
