UUID

Universally Unique IDentifier, UUID

四個版本

第 13 個字元的位置就是表示版本號

  1. 以時間和網 路卡號組成,時間是以一百奈秒為單位,網路卡號理論上是不會重複的,再加上 clock_seq 這個每次開機重設一次的亂數欄位,就算時間回朔了也不會重複, 代號是 1

  2. 以命名空間加上一個 hash 組成的,分別可以使 用MD5, 代號是 1

  3. Version 2 (DCE Security)

  4. 以命名空間加上一個 hash 組成的,分別可以使 用SHA1 演算法,算出來後就填到空位中,代號是 5

  5. 全亂數組成,代號是 4

看不同情境選用不同的uuid, 我們需要的是一組綁在同一個instance 上面但是重開機可以產生一組一樣的UUID

  • 不能綁時間

  • 不能綁硬碟

Globally Unique IDentifier, GUID (guid 是微軟所提出的標準,會用於 Windows, ActiveX 等應用中)

A Globally Unique Identifier (GUID, \/ˈɡwɪd\/or \/ˈɡuːɪd\/) is a unique reference number used as an identifier in computer software. The term GUID typically refers to various implementations of the universally unique identifier (UUID) standard

Last updated

Was this helpful?