GUID
Globally Unique ID generator
Usability
When you need to generate an unique string with very low
probability of being duplicated worldwide, from eg. a Linux
(or other) bash script. The uniqueness is maintained
by combining entropy from several sources (/dev/random, IRQ counters at
/proc/interrupts, current date/time, and the packet counters on the network
interfaces) and fixed machine-specific information (the MAC addresses of the
network interfaces from the ifconfig -a output), which is mixed up together
with the other data using a hash function, so there are no privacy implications
as the MAC address can't be recovered from the GUID.
Purpose
Whenever a reliably unique identifier is necessary to be assigned
to some data object. The object may be a database object, a file, or
an identifier of a webpage (eg. to allow finding the resource by a search
engine when its URL changes but the GUID embedded in its source is known).
The GUID string is broken to smaller parts (7 or 8 characters) to allow easier
writing down.
Usage
guid - generate a global unique identifier based on a hash of the machine
network hardware (ifconfig -a), timestamp, IRQ counter and 16 random bytes.
Usage: guid [-s|-m] [-b|-x] [-S <separator>]
where: -s sets 160-bit GUID (SHA1)
-m sets 128-bit GUID (MD5, default)
-b sets output in BASE64 encoding
-X sets output in uppercase HEX
-x sets output in lowercase HEX (default)
-S sets <separator> (default '-')
-h writes this help
Example outputs:
guid -s -x | : | 863da6a8-7be66589-4a21f83b-e1620008-8d2b939e |
guid -m -X | : | A1051E41-9633ACE1-87215E24-6A9196FB |
guid -s -b | : | ByNeoOj-zbPcDPK-PyWi2md-pQik0M |
guid -m -b | : | YqU0b1b7-6H8Qy3f-AEh9JQA |
Requires
md5sum and sha1sum - should be part of any standard distro
base64 - a base64 encoder, could be downloaded eg. here
Files
guid - shell script