add comments to base 32 module

This commit is contained in:
Sloane Perrault 2023-06-29 19:04:05 -04:00
parent a9c52b8496
commit b34945f79d
No known key found for this signature in database

View file

@ -1,6 +1,12 @@
defmodule TypeID.Base32 do
@moduledoc false
import Bitwise
# Implements base 32 encoding using the a lowercase crockford alphabet
# https://www.crockford.com/base32.html
# Borrows heavily from the core `Base` module's implementation
crockford_alphabet = ~c"0123456789ABCDEFGHJKMNPQRSTVWXYZ"
to_lower_enc = &Enum.map(&1, fn c -> if c in ?A..?Z, do: c - ?A + ?a, else: c end)