about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
diff options
context:
space:
mode:
authorTyson Nottingham <tgnottingham@gmail.com>2020-09-28 17:34:27 -0700
committerTyson Nottingham <tgnottingham@gmail.com>2020-09-30 00:57:35 -0700
commitd061fee177c70ae146db2b9720c85dc1f38215af (patch)
tree8091284d09715d640701de43d3907f2546047f0a /src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
parentfc2daaae610b5515438b551a2f3706196a997f35 (diff)
downloadrust-d061fee177c70ae146db2b9720c85dc1f38215af.tar.gz
rust-d061fee177c70ae146db2b9720c85dc1f38215af.zip
Stable hashing: add comments and tests concerning platform-independence
SipHasher128 implements short_write in an endian-independent way, yet
its write_xxx Hasher trait methods undo this endian-independence by byte
swapping the integer inputs on big-endian hardware. StableHasher then
adds endian-independence back by also byte-swapping on big-endian
hardware prior to invoking SipHasher128.

This double swap may have the appearance of being a no-op, but is in
fact by design. In particular, we really do want SipHasher128 to be
platform-dependent, in order to be consistent with the libstd SipHasher.
Try to clarify this intent. Also, add and update a couple of unit tests.
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions