You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just encountered a hash collision when registering a new class.
The problem is line 52 of Serializer.js with Utils.hashStr.
It returns the same hash (37) for two different strings: "Tile" & "NetworkedEventCollection"
Here is the test code :
import Utils from 'lance/lib/Utils';
console.log(Utils.hashStr('NetworkedEventCollection'));
console.log(Utils.hashStr('Tile'));
For now, hopefully, we can pass a classId to the registerClass method.
Shouldn't be hard to fix :)
Thanks
After some investigations, I found that the problems resides in the poor precision of the hash.
So, instead of 8 bits (default in hashStr), it can be changed to 16 and accordingly in serialize/deserialize.
Precision seems much better with this fix :)
I'm leaving on holidays so no promise, but I'll try when I have some time.
If you want further details on this because it's hight priority, I'll be happy to give you details on this issue.
Activity
titoasty commentedon May 12, 2018
After some investigations, I found that the problems resides in the poor precision of the hash.
So, instead of 8 bits (default in hashStr), it can be changed to 16 and accordingly in serialize/deserialize.
Precision seems much better with this fix :)
namel commentedon May 13, 2018
Any chance you can provide a PR on Lance on the develop branch ?
titoasty commentedon May 14, 2018
I'm leaving on holidays so no promise, but I'll try when I have some time.
If you want further details on this because it's hight priority, I'll be happy to give you details on this issue.
brianchirls commentedon Sep 13, 2019
I'm seeing this problem as well. Collision on
'TwoVector'and'Agent', both hashing to33.namel commentedon Sep 20, 2019
A simple workaround is to change the name of the class. So renaming
'Agent'to'AgentObj'works around the issue until the hash function is fixed