When are you truly forced to use UUID as part of the design?

I wrote the UUID generator/parser for Ruby, so I consider myself to be reasonably well-informed on the subject. There are four major UUID versions: Version 4 UUIDs are essentially just 16 bytes of randomness pulled from a cryptographically secure random number generator, with some bit-twiddling to identify the UUID version and variant. These are extremely … Read more

Is there a method to generate a UUID with Go language?

There is an official implementation by Google: https://github.com/google/uuid Generating a version 4 UUID works like this: package main import ( “fmt” “github.com/google/uuid” ) func main() { id := uuid.New() fmt.Println(id.String()) } Try it here: https://play.golang.org/p/6YPi1djUMj9

UUID max character length

Section 3 of RFC4122 provides the formal definition of UUID string representations. It’s 36 characters (32 hex digits + 4 dashes). Sounds like you need to figure out where the invalid 60-char IDs are coming from and decide 1) if you want to accept them, and 2) what the max length of those IDs might … Read more

How to get a unique device ID in Swift?

You can use this (Swift 3): UIDevice.current.identifierForVendor!.uuidString For older versions: UIDevice.currentDevice().identifierForVendor or if you want a string: UIDevice.currentDevice().identifierForVendor!.UUIDString There is no longer a way to uniquely identify a device after the user uninstalled the app(s). The documentation says: The value in this property remains the same while the app (or another app from the same … Read more

How to create a GUID/UUID using iOS

[[UIDevice currentDevice] uniqueIdentifier] Returns the Unique ID of your iPhone. EDIT: -[UIDevice uniqueIdentifier] is now deprecated and apps are being rejected from the App Store for using it. The method below is now the preferred approach. If you need to create several UUID, just use this method (with ARC): + (NSString *)GetUUID { CFUUIDRef theUUID … Read more

Likelihood of collision using most significant bits of a UUID in Java

According to the documentation, the static method UUID.randomUUID() generates a type 4 UUID. This means that six bits are used for some type information and the remaining 122 bits are assigned randomly. The six non-random bits are distributed with four in the most significant half of the UUID and two in the least significant half. … Read more