documentHash function
Compute the FNV-1a 64-bit document hash for a file path or string.
Cross-language stable (NOT Dart's hashCode). Used as the canonical
document key for the state backbone.
Implementation
BigInt documentHash(String path) {
final offset = BigInt.parse('cbf29ce484222325', radix: 16);
final mask = BigInt.parse('FFFFFFFFFFFFFFFF', radix: 16);
final prime = BigInt.parse('100000001b3', radix: 16);
var hash = offset;
for (final byte in path.codeUnits) {
hash = (hash ^ BigInt.from(byte)) & mask;
hash = (hash * prime) & mask;
}
return hash;
}