Source Code added
This commit is contained in:
parent
800376eafd
commit
9efa9bc6dd
3912 changed files with 754770 additions and 2 deletions
15
mobile/lib/utils/hash.dart
Normal file
15
mobile/lib/utils/hash.dart
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/// 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue