Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UUID ¶
type UUID [16]byte
A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC 4122.
var Nil UUID
Nil empty UUID, all zeros
func NewHash ¶
NewHash returns a new UUID derived from the hash of space concatenated with data generated by h. The hash should be at least 16 byte in length. The first 16 bytes of the hash are used to form the UUID. The version of the UUID will be the lower 4 bits of version.
func NewMD5 ¶
NewMD5 returns a new MD5 (Version 3) UUID based on the supplied name space and data. It is the same as calling:
NewHash(md5.New(), space, data, 3)
func NewRandom ¶
NewRandom returns a Random (Version 4) UUID.
The strength of the UUIDs is based on the strength of the crypto/rand package.
A note about uniqueness derived from the UUID Wikipedia entry:
Randomly generated UUIDs have 122 random bits. One's annual risk of being hit by a meteorite is estimated to be one chance in 17 billion, that 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.
func NewSHA1 ¶
NewSHA1 returns a new SHA1 (Version 5) UUID based on the supplied name space and data. It is the same as calling:
NewHash(sha1.New(), space, data, 5)