MD4: Difference between revisions

98 bytes added ,  9 months ago
m
Minor improveents to coding.
m (Reformatting code.)
m (Minor improveents to coding.)
Line 590:
engine_update(string_to_byte_vector(text), 0, text.length());
 
const int32_t buffer_index = (static_cast<int32_t) >( count % BLOCK_LENGTH );
const int32_t padding_length = ( buffer_index < 56 ) ? 56 - buffer_index : 120 - buffer_index;
 
Line 597:
 
for ( int32_t i = 0; i < 8; ++i ) {
tail[padding_length + i] = static_cast<int8_t>(int8_t) unsigned_right_shift(count * 8, 8 * i));
}
 
Line 605:
for ( int32_t i = 0; i < 4; ++i ) {
for ( int32_t j = 0; j < 4; ++j ) {
result[i * 4 + j] = static_cast<int8_t>(int8_t) unsigned_right_shift(context[i], 8 * j));
}
}
Line 621:
}
 
int32_t buffer_index = (static_cast<int32_t) >( count % BLOCK_LENGTH );
count += message_length;
const int32_t partial_length = BLOCK_LENGTH - buffer_index;
Line 686:
context[3] += d;
}
 
void engine_reset() {
count = 0;
Line 703:
 
std::transform(text.begin(), text.end(), std::back_inserter(bytes),
[](char ch){ return (static_cast<int8_t) >(ch); });
 
return bytes;
Line 712:
return 0;
}
return ( base > 0 ) ? base >> shift : ( base + 4'294'967'296TWO_POWER_32 ) >> shift;
}
 
Line 740:
 
const int32_t BLOCK_LENGTH = 64;
const int64_t TWO_POWER_32 = 4'294'967'296;
};
 
895

edits