You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # UUID package for Go language
  2. [![Build Status](https://travis-ci.org/satori/go.uuid.png?branch=master)](https://travis-ci.org/satori/go.uuid)
  3. [![Coverage Status](https://coveralls.io/repos/github/satori/go.uuid/badge.svg?branch=master)](https://coveralls.io/github/satori/go.uuid)
  4. [![GoDoc](http://godoc.org/github.com/satori/go.uuid?status.png)](http://godoc.org/github.com/satori/go.uuid)
  5. This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs.
  6. With 100% test coverage and benchmarks out of box.
  7. Supported versions:
  8. * Version 1, based on timestamp and MAC address (RFC 4122)
  9. * Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1)
  10. * Version 3, based on MD5 hashing (RFC 4122)
  11. * Version 4, based on random numbers (RFC 4122)
  12. * Version 5, based on SHA-1 hashing (RFC 4122)
  13. ## Installation
  14. Use the `go` command:
  15. $ go get github.com/satori/go.uuid
  16. ## Requirements
  17. UUID package requires Go >= 1.2.
  18. ## Example
  19. ```go
  20. package main
  21. import (
  22. "fmt"
  23. "github.com/satori/go.uuid"
  24. )
  25. func main() {
  26. // Creating UUID Version 4
  27. u1 := uuid.NewV4()
  28. fmt.Printf("UUIDv4: %s\n", u1)
  29. // Parsing UUID from string input
  30. u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
  31. if err != nil {
  32. fmt.Printf("Something gone wrong: %s", err)
  33. }
  34. fmt.Printf("Successfully parsed: %s", u2)
  35. }
  36. ```
  37. ## Documentation
  38. [Documentation](http://godoc.org/github.com/satori/go.uuid) is hosted at GoDoc project.
  39. ## Links
  40. * [RFC 4122](http://tools.ietf.org/html/rfc4122)
  41. * [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01)
  42. ## Copyright
  43. Copyright (C) 2013-2018 by Maxim Bublis <b@codemonkey.ru>.
  44. UUID package released under MIT License.
  45. See [LICENSE](https://github.com/satori/go.uuid/blob/master/LICENSE) for details.