         <<>> ->
           <<>>
       end
-      main <> maybe_pad(tail, pad_flag, 8, ?=)
+      main <> maybe_pad(tail, pad_flag, 8, "=")
     end
   end
 
   defp do_hex_decode32(_, <<>>, _), do: <<>>
   defp do_hex_decode32(case, string, false),
-    do: do_hex_decode32(case, maybe_pad(string, true, 8, ?=), true)
+    do: do_hex_decode32(case, maybe_pad(string, true, 8, "="), true)
 
   for {case, fun} <- [upper: :from_upper, lower: :from_lower, mixed: :from_mixed] do
     defp do_hex_decode32(unquote(case), string, _pad_flag) when rem(byte_size(string), 8) == 0 do

      <<>> ->
        <<>>
    end
    main <> maybe_pad(tail, pad_flag, 4, ?=)
  end

  defp do_decode64url(<<>>, _), do: <<>>
  defp do_decode64url(string, false) do
    maybe_pad(string, true, 4, ?=) |> do_decode64url(true)
  end
  defp do_decode64url(string, _pad_flag) when rem(byte_size(string), 4) == 0 do
    split = byte_size(string) - 4

      <<>> ->
        <<>>
    end
    main <> maybe_pad(tail, pad_flag, 4, "=")
  end

  defp do_decode64(<<>>, _), do: <<>>
  defp do_decode64(string, false) do
    maybe_pad(string, true, 4, "=") |> do_decode64(true)
  end
  defp do_decode64(string, _pad_flag) when rem(byte_size(string), 4) == 0 do
    split = byte_size(string) - 4
