Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/elixirs/base62

Base62 encoder/decoder in pure Elixir
https://github.com/elixirs/base62

base62 decoder decoding elixir encoder encoding hacktoberfest

Last synced: 7 days ago
JSON representation

Base62 encoder/decoder in pure Elixir

Awesome Lists containing this project

README

        

# Base62 [![Version](https://img.shields.io/hexpm/v/base62.svg?style=flat-square)](https://hex.pm/packages/base62)[![License](https://img.shields.io/hexpm/l/base62.svg?style=flat-square)](https://github.com/elixirs/base62/blob/main/LICENSE)![Build Status](https://img.shields.io/github/workflow/status/elixirs/base62/CI/main?style=flat-square)[![Issues](https://img.shields.io/github/issues/elixirs/base62.svg?style=flat-square)](https://github.com/elixirs/base62/issues)[![Downloads](https://img.shields.io/hexpm/dt/base62.svg?style=flat-square)](https://hex.pm/packages/base62)

Base62 encoder/decoder in pure Elixir.

## Usage

### Encode

```elixir
iex> Base62.encode(28)
"S"

iex> Base62.encode(44)
"i"

iex> Base62.encode(280)
"4W"
```

### Decode!

```elixir
iex> Base62.decode!("100")
3844

iex> Base62.decode!("igas")
10650166

iex> Base62.decode!("EvilMartians")
776957886790921093120
```

### Decode

```elixir
iex> Base62.decode("42")
{:ok, 250}

iex> Base62.decode("Игас")
:error

iex> Base62.decode("Elixir")
{:ok, 13531063449}
```

# [License](https://github.com/elixirs/base62/blob/main/LICENSE)

Released under the MIT License.