# BasedIntegers

>These integers are based man, no cap

The library is a tool for creating fast BaseN codecs for shortening integers, typically used
in identifiers. It's a full rewrite of [the CustomBase library](https://hex.pm/packages/custom_base)
with ~2-5x speed gain (benchmarks are included) and is almost a drop-in replacement.
Written in pure Elixir without NIFs.

## Installation

The package can be installed by adding `based_integers` to your list of dependencies in `mix.exs`:
```elixir
def deps do
  [
    {:based_integers, "~> 0.1.0"}
  ]
end
```

## Usage

Create your codec module:
```elixir
defmodule MyBase62 do
  use BasedIntegers, alphabet: ~c"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
end
```
The module will have `encode/1`, `decode/1` and `decode!/1` functions.

## License

Copyright 2026 Andrey Tretyakov  
The source code of the project is released under Apache License 2.0.
Check LICENSE file for more information.
