How short can a GUID be?

前端 未结 6 1790
离开以前
离开以前 2021-02-07 04:01

I know the standard GUIDs. Can they be made shorter? What is the theory behind it?

6条回答
  •  后悔当初
    2021-02-07 04:52

    Put very simply, GUIDs are guaranteed to be unique because they act like coordinates.

    Traditionally*, one half was specific to the machine (by using the MAC address) and one half was derived from the time.

    Because MACs are unique between machines and each machine can execute one instruction at a time (traditionally remember!) the GUID will definitely be unique.

    This means however, that if you ditch any part of a GUID, you lose the guarantee of uniqueness. Mr. Martelli gives a good explanation of why this is more of a problem than you might assume.

    *I say traditionally, but I've never read an article that indicates a major change. I don't think actual MACs are used nowadays (for security reasons I guess), but I think they're still MAC-derived or at least machine specific.

提交回复
热议问题