MD4: Difference between revisions

Content added Content deleted
m (Minor improveents to coding.)
m (Minor code improvement.)
Line 709: Line 709:


int32_t unsigned_right_shift(const int32_t& base, const int32_t& shift) {
int32_t unsigned_right_shift(const int32_t& base, const int32_t& shift) {
if ( base == 0 || shift >= 32 ) {
if ( shift < 0 || shift >= 32 ) {
return 0;
return 0;
}
}
return ( base > 0 ) ? base >> shift : ( base + TWO_POWER_32 ) >> shift;
if ( base == 0 ) {
return 0;
}
return ( base > 0 ) ? base >> shift : static_cast<uint32_t>(base) >> shift;
}
}


Line 740: Line 743:


const int32_t BLOCK_LENGTH = 64;
const int32_t BLOCK_LENGTH = 64;
const int64_t TWO_POWER_32 = 4'294'967'296;
};
};