From b34945f79dffe9d9abeac753a16ce690c7e895b1 Mon Sep 17 00:00:00 2001 From: Sloane Perrault Date: Thu, 29 Jun 2023 19:04:05 -0400 Subject: [PATCH] add comments to base 32 module --- lib/type_id/base32.ex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/type_id/base32.ex b/lib/type_id/base32.ex index 16d4191..1bacc25 100644 --- a/lib/type_id/base32.ex +++ b/lib/type_id/base32.ex @@ -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)