[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Getting a unique ID for a system?



Richard Hartmann wrote:
On Mon, Nov 17, 2008 at 19:04, Steve Kemp <skx@debian.org> wrote:

 hostid - contained in the coreutils package.

Unfortunately, this id is either read from /etc/hostid or calculated
from the IPv4 address which a gethostbyhostname_r(3) on the
system's hostname returns.
This means the id is not persistant.

Thanks though,
Richard



I've absolutely no idea what you are trying to do here or why. I'm a little curious about that.

But if you are trying to find a unique id that isn't tied to hardware or pretty much anything else then why not just make one up.


Here:  I wrote this in the middle of this email:

#!/usr/bin/perl

use strict;
use warnings;
use Time::HiRes qw[gettimeofday];
use Digest::MD5 qw[md5_hex];

my $t = [gettimeofday];
my $h = md5_hex($t, rand());

print "$h,\n";


It will give you a hex uuid that would be hard to collide with.
If you want, mix the hard drive serial number into the md5_hex array.


Reply to: