
On 12/6/24 20:30, Peter Dimov via Boost wrote:
You can see practical manifestations of these examples in e.g
https://github.com/pdimov/hash2/blob/develop/include/boost/hash2/md5.hpp
where at
https://github.com/pdimov/hash2/blob/26b16023dc639ae354e246458719e4b569bc1d9...
you have
BOOST_CXX14_CONSTEXPR void transform( unsigned char const block[ 64 ] )
with the implicit precondition that `block` points at at least 64 valid bytes, and then at
https://github.com/pdimov/hash2/blob/26b16023dc639ae354e246458719e4b569bc1d9...
you have
for( int i = 0; i < 16; ++i ) { x[ i ] = detail::read32le( block + i * 4 ); }
which relies on this implicit precondition to read 16 subspans of size 4.
Assuming you had code like this:
void transform( span