How to create a UUID in bash?

See the uuidgen program which is part of the e2fsprogs package. According to this, libuuid is now part of util-linux and the inclusion in e2fsprogs is being phased out. However, on new Ubuntu systems, uuidgen is now in the uuid-runtime package. To create a uuid and save it in a variable: uuid=$(uuidgen) On my Ubuntu … Read more

Beacon UUID vs BeaconLayout

A beacon “layout” refers to the beacon format, specifically how the different fields are encoded into bytes needed to transmit the information inside Bluetooth LE advertising packets. Some companies like Apple maintain their beacon formats as trade secrets, so they don’t allow them to be published. Open source modules like the Android Beacon Library can’t … Read more

How to test valid UUID/GUID?

Currently, UUID’s are as specified in RFC4122. An often neglected edge case is the NIL UUID, noted here. The following regex takes this into account and will return a match for a NIL UUID. See below for a UUID which only accepts non-NIL UUIDs. Both of these solutions are for versions 1 to 5 (see the … Read more

How to create a GUID / UUID

UUIDs (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDentifier), according to RFC 4122, are identifiers designed to provide certain uniqueness guarantees. While it is possible to implement RFC-compliant UUIDs in a few lines of JavaScript code (e.g., see @broofa’s answer, below) there are several common pitfalls: Invalid id format (UUIDs must be of the form … Read more

When should I use uuid.uuid1() vs. uuid.uuid4() in python?

uuid1() is guaranteed to not produce any collisions (under the assumption you do not create too many of them at the same time). I wouldn’t use it if it’s important that there’s no connection between the uuid and the computer, as the mac address gets used to make it unique across computers. You can create duplicates by creating … Read more

How to create a GUID/UUID in Python

The uuid module provides immutable UUID objects (the UUID class) and the functions uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5 UUIDs as specified in RFC 4122. If all you want is a unique ID, you should probably call uuid1() or uuid4(). Note that uuid1() may compromise privacy since it creates a UUID containing … Read more