mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 15:58:35 +02:00
Fix XORing algorithm
This commit is contained in:
parent
3a11e84c94
commit
f06ac911c5
1 changed files with 1 additions and 3 deletions
|
@ -27,12 +27,10 @@ void saltingHelper(char* start, int size, Key key) {
|
||||||
const auto end = start + size;
|
const auto end = start + size;
|
||||||
|
|
||||||
auto p = start;
|
auto p = start;
|
||||||
for (; p < end; p += sizeof(Key)) {
|
for (; p + sizeof(Key) < end; p += sizeof(Key)) {
|
||||||
*reinterpret_cast<Key*>(p) ^= key;
|
*reinterpret_cast<Key*>(p) ^= key;
|
||||||
}
|
}
|
||||||
|
|
||||||
p -= sizeof(Key);
|
|
||||||
|
|
||||||
for (int i = 0; p < end; ++p || ++i) {
|
for (int i = 0; p < end; ++p || ++i) {
|
||||||
*p ^= *(reinterpret_cast<const char*>(&key) + i);
|
*p ^= *(reinterpret_cast<const char*>(&key) + i);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue