mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-08 08:52:15 +02:00
* Resove computeQuickXorHash generates a different hash when files are > 64Kb
This commit is contained in:
parent
c0d2874ace
commit
f3f216c1a8
|
@ -2,7 +2,7 @@ import std.algorithm;
|
||||||
import std.digest.digest;
|
import std.digest.digest;
|
||||||
|
|
||||||
// implementation of the QuickXorHash algorithm in D
|
// implementation of the QuickXorHash algorithm in D
|
||||||
// https://github.com/OneDrive/onedrive-api-docs/blob/master/snippets/quickxorhash.md
|
// https://github.com/OneDrive/onedrive-api-docs/blob/live/docs/code-snippets/quickxorhash.md
|
||||||
struct QuickXor
|
struct QuickXor
|
||||||
{
|
{
|
||||||
private immutable int widthInBits = 160;
|
private immutable int widthInBits = 160;
|
||||||
|
@ -32,9 +32,9 @@ struct QuickXor
|
||||||
} else {
|
} else {
|
||||||
int index1 = vectorArrayIndex;
|
int index1 = vectorArrayIndex;
|
||||||
int index2 = isLastCell ? 0 : (vectorArrayIndex + 1);
|
int index2 = isLastCell ? 0 : (vectorArrayIndex + 1);
|
||||||
byte low = cast(byte) (bitsInVectorCell - vectorOffset);
|
ubyte low = cast(ubyte) (bitsInVectorCell - vectorOffset);
|
||||||
|
|
||||||
byte xoredByte = 0;
|
ubyte xoredByte = 0;
|
||||||
for (size_t j = i; j < array.length; j += widthInBits) {
|
for (size_t j = i; j < array.length; j += widthInBits) {
|
||||||
xoredByte ^= array[j];
|
xoredByte ^= array[j];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue