A simple implementation of GUID/UUID


GUID, Globally Unique Identifier, aka UUID(Universally Unique Identifier), is very useful when you need a global identifier in you program.
GUID is a 128-bit integer number used to identify resources. The term GUID is generally used by developers working with Microsoft technologies, while UUID is used everywhere else.
For more information, you can visit:
1. IETF: RFC 4122 – http://www.ietf.org/rfc/rfc4122.txt (There’s a full implementation UUID in the Appendix A)
2. Wikipedia: Globally Unique Identifier – http://en.wikipedia.org/wiki/Globally_Unique_Identifier
3. Microsoft: GUID Structure – http://msdn2.microsoft.com/en-us/library/aa373931.aspx

Here is a simple/sample implementation of generating a GUID for yourself.

In fact, RFC4122 provided a full implementation of UUID in Appendix A – Sample Implementation. If you need to implement a strictly standard version of UUID/GUID, you can use that code directly.

Leave a comment

Your email address will not be published. Required fields are marked *