fastHash property

int get fastHash

针对 Dart 字符串优化的 64 位哈希算法 FNV-1a

Implementation

int get fastHash {
  dynamic hash = BigInt.parse('0xcbf29ce484222325');

  var i = 0;
  while (i < length) {
    final codeUnit = codeUnitAt(i++);
    hash ^= codeUnit >> 8;
    hash *= 0x100000001b3;
    hash ^= codeUnit & 0xFF;
    hash *= 0x100000001b3;
  }

  return hash;
}