Giter VIP home page Giter VIP logo

uuid's Introduction

Go UUID implementation

Build Status GoDoc

This package provides RFC 4122 compliant UUIDs. It will generate the following:

  • Version 1: based on timestamp and MAC address
  • Version 3: based on MD5 hash
  • Version 4: based on crytographically secure random numbers
  • Version 5: based on SHA-1 hash

Functions NewV1, NewV3, NewV4, NewV5, New, NewHex and ParseUUID() for generating versions 3, 4 and 5 UUIDs are as specified in RFC 4122.

Requirements

Go 1.2 and tip supported.

Recent Changes to original work by nu7hatch

  • Varient type bits are now set correctly
  • Varient type can now be retrieved more efficiently
  • New tests for variant setting to confirm correctness
  • New tests added to confirm proper version setting
  • Type UUID change to UUIDArray for V3-5 UUIDS and UUIDStruct added for V1 UUIDs ** These implement the BinaryMarshaller and BinaryUnmarshaller interfaces
  • New was added to create a base UUID from a []byte slice - this uses UUIDArray
  • ParseHex was renamed to ParseUUID
  • NewHex now performs unsafe creation of UUID from a hex string
  • NewV3 and NewV5 now take anything that implements the Stringer interface
  • V1 UUIDs can now be created
  • The printing format can be changed

Installation

Use the go tool:

$ go get github.com/twinj/uuid

Usage

See documentation and examples for more information.

Copyright

This is a derivative work

Orginal version from Copyright (C) 2011 by Krzysztof Kowalik [email protected]. See COPYING file for details.

Also see: Algorithm details in RFC 4122.

Copyright (C) 2014 [email protected] See LICENSE file for details.

uuid's People

Contributors

badslug avatar twinj avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.