View Source ShortUUID

An Elixir module for handling ShortUUIDs.

This module provides functions to encode and decode between regular UUIDs and ShortUUIDs.

It can be especially useful when you want to use UUIDs, but you need them to be shorter. For example, you can use ShortUUIDs in URL shorteners or for a more user-friendly representation of UUIDs.

Inspired by bitcoin.

examples

Examples

iex> ShortUUID.encode("64d7280f-736a-4ffa-b9c0-383f43486d0b")
{:ok, "DTEETeS5R2XxjrVTZxXoJS"}

iex> ShortUUID.decode("DTEETeS5R2XxjrVTZxXoJS")
{:ok, "64d7280f-736a-4ffa-b9c0-383f43486d0b"}

installation

Installation

Add short_uuid to your list of dependencies in mix.exs:

def deps do
  [
    {:short_uuid, "~> 2.1.0"}
  ]
end

license

License

MIT