Fix XORing algorithm

This commit is contained in:
Atlante45 2016-02-19 16:05:57 -08:00
parent 3a11e84c94
commit f06ac911c5

View file

@ -27,12 +27,10 @@ void saltingHelper(char* start, int size, Key key) {
const auto end = start + size;
auto p = start;
for (; p < end; p += sizeof(Key)) {
for (; p + sizeof(Key) < end; p += sizeof(Key)) {
*reinterpret_cast<Key*>(p) ^= key;
}
p -= sizeof(Key);
for (int i = 0; p < end; ++p || ++i) {
*p ^= *(reinterpret_cast<const char*>(&key) + i);
}