On Tue, 9 Sep 2003, Ulrich Drepper wrote:
This is the job of the gethostid() function which is even in POSIX so you really shouldn't have looked far.
But the implementation of this function isn't something you will like. It does not provide a secure mechanism. The sysadmin is able to change the information at will. Well, using the uname() function would have the same problem. One would just have to preload a DSO with the appropriate gethostid/uname/... implementation which returns the right number.
If you need something which cannot be tempered with you need to install extra hardware like a dongle.
Dongles can be tampered with using a logic probe and oscilloscope. ;o)