PHP function to generate v4 UUID

Instead of breaking it down into individual fields, it’s easier to generate a random block of data and change the individual byte positions. You should also use a better random number generator than mt_rand(). According to RFC 4122 – Section 4.4, you need to change these fields: time_hi_and_version (bits 4-7 of 7th octet), clock_seq_hi_and_reserved (bit … Read more

How good is Java’s UUID.randomUUID?

UUID uses java.security.SecureRandom, which is supposed to be “cryptographically strong”. While the actual implementation is not specified and can vary between JVMs (meaning that any concrete statements made are valid only for one specific JVM), it does mandate that the output must pass a statistical random number generator test. It’s always possible for an implementation … Read more

Which UUID version to use?

There are two different ways of generating a UUID. If you just need a unique ID, you want a version 1 or version 4. Version 1: This generates a unique ID based on a network card MAC address and current time. If any of these things is sensitive in any way, don’t use this. The … Read more

How unique is UUID?

Very safe: the annual risk of a given person being hit by a meteorite is estimated to be one chance in 17 billion, which means the probability is about 0.00000000006 (6 × 10−11), equivalent to the odds of creating a few tens of trillions of UUIDs in a year and having one duplicate. In other … Read more

Is there any difference between a GUID and a UUID?

The simple answer is: **no difference, they are the same thing. 2020-08-20 Update: While GUIDs (as used by Microsoft) and UUIDs (as defined by RFC4122) look similar and serve similar purposes, there are subtle-but-occasionally-important differences. Specifically, some Microsoft GUID docs allow GUIDs to contain any hex digit in any position, while RFC4122 requires certain values … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)