1
0
mirror of https://github.com/immich-app/immich.git synced 2026-05-21 21:48:14 +02:00
Files
immich/mobile/lib/utils/hash.dart
T

16 lines
343 B
Dart
Raw Normal View History

/// FNV-1a 64bit hash algorithm optimized for Dart Strings
int fastHash(String string) {
var hash = 0xcbf29ce484222325;
var i = 0;
while (i < string.length) {
final codeUnit = string.codeUnitAt(i++);
hash ^= codeUnit >> 8;
hash *= 0x100000001b3;
hash ^= codeUnit & 0xFF;
hash *= 0x100000001b3;
}
return hash;
}