hash function for suunto solution

Jef Driesen jef at libdivecomputer.org
Fri Jan 20 04:04:52 PST 2017


On 2017-01-19 23:06, Kristaps Dzonsons wrote:
> The Suunto Solution seems to be the only dc that doesn't support
> fingerprints.  This annoys me because I can't fully rely on
> dc_device_set_fingerprint(3) and I like that function.
> 
> So I've added a hash function that creates a suunto solution
> fingerprint, then added the infrastructure to set, compare, and pass to
> the caller.

The integration looks good, but the implementation of the hash function 
isn't portable. It depends for example on the endianess of the system 
and there might also be issues related to unaligned access. The 
fingerprint should always be identical and certainly independent of the 
underlying system.

I tested your code on a 64bit x86 and 32bit ARM system, and the 
generated fingerprints are different.

> Caveat emptor! I haven't tested it because I don't have a suunto 
> solution.

You can use the libdivecomputer simulator for testing:

http://libdivecomputer.org/simulator.html

I have test data available for (almost) every model supported by 
libdivecomputer.

> Downsides to using a hash function?  It might be duplicated.  However,
> given that this is a 128 bit hash, that's not terribly likely.

I think the risk is pretty low, even with some very weak hash. Anyway, I 
wouldn't worry too much about collisions. The Suunto Solution is a very 
old model. I wouldn't be surprised if there are only a few users left.

> If this is ok, I can update the docs to reflect that setting the
> fingerprint is fully supported.

Sure.

Jef


More information about the devel mailing list