euuid
euuid copied to clipboard
Erlang UUID module (versions 1, 3, 4, 5).
Erlang UUID
An Erlang implementation of the Universally Unique IDentifier (UUID) URN Namespace as defined in RFC 4122. This module implements the UUID versions 1, 3, 4 and 5. It also implements a custom time based UUID that is based on version 1 but has a different layout to allow easy sorting on the creation date.
Compiling
$ ./rebar compile
or
$ ./rebar compile eunit
to run the unit tests.
Usage
euuid:start(). ok
euuid:v1(). 154506924620507745341751420074171965700
euuid:format(euuid:v1()). "888fd0b0-b46c-11df-85e8-6fb918f22104"
euuid:format(euuid:v5(euuid:ns_dns(), "example.com")). "cfbff0d1-9375-5685-968c-48ce8b15ae17"
euuid:format(euuid:time_custom()). "1dfb46dc-6556-f54e-85e8-6fb918f22104"
euuid:format(euuid:nil()). "00000000-0000-0000-0000-000000000000"
euuid:stop(). ok
License
The MIT license.
Copyright (c) 2010-2011 Martijn Rijkeboer
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.