basalt / drives-microsoft/src / toChecksum
Function: toChecksum()
> toChecksum(hashes): DriveChecksum | undefined
Defined in: drives-microsoft/src/metadata.ts:85
Picks the checksum, and labels it honestly.
Graph publishes a different digest depending on what kind of account the drive belongs to, and they are not interchangeable:
quickXorHashon OneDrive for Business and SharePoint — a Microsoft block-XOR construction, base64-encoded, with no counterpart anywhere else.sha1Hash/sha256Hashon personal OneDrive — real digests, but uppercase hex in Graph's output, so they are lowercased here to match the contract's "lowercase hex".
The consequence is stated in the README and worth repeating: a checksum is comparable within one provider, and on Graph only within one account type. An app that compares a quickXorHash from a Business drive with a sha256 from a personal one is comparing two different functions of two different inputs and will conclude the files differ every time.
quickXorHash is preferred when present because it is the only hash a Business drive publishes at all; a personal drive publishes the other two.
Parameters
hashes
GraphHashes | undefined
Returns
DriveChecksum | undefined