NAME
    App::CrockfordBase32Utils - Utilities related to Crockford's Base 32
    encoding

VERSION
    This document describes version 0.004 of App::CrockfordBase32Utils (from
    Perl distribution App-CrockfordBase32Utils), released on 2026-01-20.

DESCRIPTION
    This distribution contains the following CLIs:

    *   cfbase32-decode

    *   cfbase32-encode

    *   cfbase32-rand

    *   cfbase32-to-num

    *   num-to-cfbase32

    Keywords: base32, base 32, crockford's base 32

FUNCTIONS
  cfbase32_decode
    Usage:

     cfbase32_decode(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Decode Crockford's Base32-encoded string.

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   str => *str*

        (No description)

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

  cfbase32_encode
    Usage:

     cfbase32_encode(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Encode string to Crockford's Base32 encoding.

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   str => *str*

        (No description)

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

  cfbase32_rand
    Usage:

     cfbase32_rand(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Generate one or more Crockford Base 32 numbers.

    Examples:

    *   Generate 35 random numbers from 12 digits each, first digit(s) can
        be 0:

         cfbase32_rand(len => 12, num => 35);

        Result:

         [
           200,
           "OK",
           [
             "N3JMT6M2B0YG",
             "DBWTMFBKN9FE",
             "ECXZ0V5NM50M",
             "A6Y4C9SVQ6MX",
             "04K9ESNZX5AS",
             "WDWJEAZMEP90",
             "VNWTY2GFMWZR",
             "YEPGJ07130R2",
             "8CWMYHH1CSHS",
             "HV28X0F3H0N4",
             "B34989JWPSF0",
             "918Y3WJPMJMS",
             "90S75ZA6MJ06",
             "GBFJST7DRE0H",
             "7ANA09TSMED6",
             "KGJYYKYVPCCY",
             "AT483B8M52KN",
             "XCZ307G6DP6E",
             "NVRMYT9CZB56",
             "FHT5Q5343NK3",
             "JDNGZ9XSJB84",
             "58QW86W68A1M",
             "QKTEQVF1HZW6",
             "SMA4MWZ6ZQBG",
             "35HZ7H7Q8AG8",
             "5D9ESKZRCNWY",
             "1KVJR6TP51TV",
             "E5ZH7XFZ1WSR",
             "40CR2BFKSVWG",
             "EB9SCPETF17N",
             "P7YD2HJ0FWD6",
             "948KKKFYF48S",
             "FKZ7Y78YRJ38",
             "DVRJVT0BV18J",
             "4ENMAQ4S7YGB",
           ],
           {},
         ]

    *   Generate 35 random numbers from 12 digits each, first digit(s)
        CANNOT be 0:

         cfbase32_rand(len => 12, num => 35, zero_prefix => 0);

        Result:

         [
           200,
           "OK",
           [
             "PGDH9MK94177",
             "GVR2DNYFRRK2",
             "DB0V0N779QTJ",
             "AYNKPKJ4ZF09",
             "XFTYF1MR0T68",
             "AJ0FE5E7MTVA",
             "TW424P6DG0FJ",
             "ZTDCSQFHFPHQ",
             "SN4HHMADK3XH",
             "CB3GSGDRTM8T",
             "BNCGYF8SDZ3V",
             "HQYEPQFZGVM0",
             "EN4FXQK16TB4",
             "G36JTTAV66N7",
             "METRYBJKW96H",
             "H9F232BEB7EN",
             "TZ0DSD7ZWSY3",
             "D6FDSDKPBAM9",
             "16CCRSW9SAPA",
             "NW6S9RPF6TBK",
             "7WT638GKRZGS",
             "C9ZT146KW0S4",
             "YMBY6B8SDMEE",
             "VZFFAACX60ZV",
             "PHV5Q2JXSNS0",
             "RSF4X7Z9R05Y",
             "ZJ4DCZ02T5PN",
             "YAN01K86KMQ5",
             "AACED7N0Y99E",
             "ZHZ0JF7ZXNJR",
             "D9R0A5S7ET68",
             "3BTRMB7B1SP1",
             "T9WTQ4VCM95P",
             "DD6BCWBYZB3J",
             "S5HEQ0AAWMFR",
           ],
           {},
         ]

    *   Generate a formatted random code:

         cfbase32_rand(fill_char_template => "###-###-###", len => 9); # -> [200, "OK", ["1A8-ZR5-PCY"], {}]

    This routine uses Math::Random::Secure for cryptographically secure
    random number generator.

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   fill_char_template => *str*

        Provide a template for formatting number, e.g. "###-###-###".

        See String::FillCharTemplate for more details.

    *   len => *int*

        Specify how many number of digits to generate for a number.

        Note that the first digit can still be 0 unless zero_prefix is set
        to false.

    *   max_base32 => *str*

        (No description)

    *   max_int => *int*

        (No description)

    *   max_len => *int*

        Specify how many maximum number of digits to generate.

        Note that the first digit can still be 0 unless zero_prefix is set
        to false.

    *   min_base32 => *str*

        (No description)

    *   min_int => *int*

        (No description)

    *   min_len => *int*

        Specify how many minimum number of digits to generate.

        Note that the first digit can still be 0 unless zero_prefix is set
        to false.

    *   num => *uint* (default: 1)

        Specify how many numbers to generate.

    *   prev_file => *filename*

        Load list of previous numbers from the specified file.

        The file will be read per-line. Empty lines and lines starting with
        "#" will be skipped. Non-digits will be removed first. Lowercase
        will be converted to uppercase. I L will be normalized to 1, O will
        be normalized to 0.

    *   unique => *bool*

        Whether to avoid generating previously generated numbers.

    *   zero_prefix => *bool* (default: 1)

        When generating random number of certain length range, whether the
        first digit is allowed to be zero.

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

  cfbase32_to_num
    Usage:

     cfbase32_to_num(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Convert Crockford's Base 32 encoding to integer decimal number.

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   strs => *array[str]*

        (No description)

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

  num_to_cfbase32
    Usage:

     num_to_cfbase32(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Convert integer decimal number(s) to Crockford's Base 32 encoding.

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   nums => *array[int]*

        (No description)

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/App-CrockfordBase32Utils>.

SOURCE
    Source repository is at
    <https://github.com/perlancar/perl-App-CrockfordBase32Utils>.

SEE ALSO
    <https://www.crockford.com/base32.html>

AUTHOR
    perlancar <perlancar@cpan.org>

CONTRIBUTING
    To contribute, you can send patches by email/via RT, or send pull
    requests on GitHub.

    Most of the time, you don't need to build the distribution yourself. You
    can simply modify the code, then test via:

     % prove -l

    If you want to build the distribution (e.g. to try to install it locally
    on your system), you can install Dist::Zilla,
    Dist::Zilla::PluginBundle::Author::PERLANCAR,
    Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two
    other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps
    required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE
    This software is copyright (c) 2026 by perlancar <perlancar@cpan.org>.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

BUGS
    Please report any bugs or feature requests on the bugtracker website
    <https://rt.cpan.org/Public/Dist/Display.html?Name=App-CrockfordBase32Ut
    ils>

    When submitting a bug or request, please include a test-file or a patch
    to an existing test-file that illustrates the bug or desired feature.

