Closed KMax closed 9 years ago
I chose fnv1 hashing. Here's the code implementation with unsigned int:
private static final int FNV_32_INIT = 0x811c9dc5;
private static final int FNV_32_PRIME = 0x01000193;
int h = FNV_32_INIT;
final int len = name.length();
for(int i = 0; i < len; i++) {
h ^= name.charAt(i);
h *= FNV_32_PRIME;
}
long longHash = h & 0xffffffffl;
Currently we don't use dereferenceable URIs for the systems (aka devices), because we don't have an API which could provide such a capability. But since we're working on such an API (#93) when we need to think about it.
An obvious option is
http://[domain]/systems/[System ID]
, but how to generate the[System ID]
?I think it should be generated by a hash function which will work like this:
[driver id]+[device id]
where[device id]
generated by the driver itself and should uniquely identify the device, e.g. MAC address of the device could be used. So if we remove the device and then get it back it should have the same[device id]
.[System ID]
.There is a good overview and comparison of existing hash function.