// lib/remote/remote_content_ids.dart class RemoteContentIds { static const int _base = 1000000000; static const int _range = 900000000; /// Genera un contentId numerico stabile per entry remote. /// /// Input consigliato: /// - uri canonica: `aves-remote://rid/` /// - fallback: remotePath /// /// Non usare String.hashCode per persistenza. static int make(String source) { final normalized = source.trim(); if (normalized.isEmpty) { return _base; } final hash = _fnv1a32(normalized); return _base + (hash % _range); } /// FNV-1a 32 bit, deterministico e semplice. static int _fnv1a32(String input) { const int fnvPrime = 0x01000193; int hash = 0x811c9dc5; for (final unit in input.codeUnits) { hash ^= unit; hash = (hash * fnvPrime) & 0xffffffff; } return hash & 0x7fffffff; } }