Acme-CPANModules-UUID

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    --help".

DESCRIPTION
    UUIDs (Universally Unique Identifiers), sometimes also called GUIDs
    (Globally Unique Identifiers), are 128-bit numbers that can be used as
    permanent IDs or keys in databases. There are several standards that
    specify UUID, one of which is RFC 4122 (2005), which we will follow in
    this document.

    UUIDs are canonically represented as 32 hexadecimal digits in the form
    of:

     xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx

    There are several variants of UUID. The variant information is encoded
    using 1-3 bits in the "N" position. RFC 4122 defines 4 variants (0 to
    3), two of which (0 and 3) are for legacy UUIDs, so that leaves variants
    1 and 2 as the current specification.

    There are 5 "versions" of UUID for both variants 1 & 2, each might be
    more suitable than others in specific cases. The version information is
    encoded in the M position. Version 1 (v1) UUIDs are generated from a
    time and a node ID (usually the MAC address); version 2 (v2) UUIDs from
    an identifier (group/user ID), a time, and a node ID; version 4 (v4)
    UUIDs from a rando/mpseudo-random number; version 3 (v3) UUIDs from
    hashing a namespace using MD5; version 5 (v5) from hashing a namespace
    using SHA-1.

    Data::UUID should be your first choice, and when you cannot install XS
    modules you can use UUID::Tiny instead.

    Aside from the modules listed as entries below, there are also:
    App::UUIDUtils (containing CLIs to create/check UUID), Data::GUID
    (currently just a wrapper for Data::UUID).

ACME::CPANMODULES ENTRIES
    Data::UUID
        Author: RJBS <https://metacpan.org/author/RJBS>

        This module creates v1 and v2 UUIDs. Depending on the OS, for MAC
        address, it usually uses a hash of hostname instead. This module is
        XS, so performance is good. If you cannot use an XS module, try
        UUID::Tiny instead.

        The benchmark code creates 1000+1 v1 string UUIDs.

    UUID::FFI
        Author: PLICEASE <https://metacpan.org/author/PLICEASE>

        This module provides access to libuuid via the FFI interface. It can
        create v1 as well as v4 (random) UUIDs. Note that Data::UUID
        (XS-based) is faster this module (FFI-based).

        The benchmark code creates 1000+1 v1 string UUIDs.

    UUID::Tiny
        Author: CAUGUSTIN <https://metacpan.org/author/CAUGUSTIN>

        This module should be your go-to choice if you cannot use an XS
        module. It can create v1, v3, v4 UUIDs. However, the random v4 UUIDs
        are not cryptographically secure; if you need cryptographically
        secure random UUIDs, use Crypt::Misc.

        The benchmark code creates 1000+1 v1 string UUIDs.

        See also: Types::UUID which is a type library that uses Data::UUID
        as the backend.

    UUID::Random
        Author: PERLER <https://metacpan.org/author/PERLER>

        This module simply uses 32 calls to Perl's rand() to construct each
        random hexadecimal digits of the UUID (v4). Not really recommended,
        since perl's default pseudo-random generator is neither
        cryptographically secure nor has 128 bit of entropy. It also does
        not produce v4 UUIDs that conform to RFC 4122 (no encoding of
        variant & version information).

        To create a cryptographically secure random UUIDs, use Crypt::Misc.

        The benchmark code creates 1000+1 v4 string UUIDs.

    UUID::Random::PERLANCAR
        Author: PERLANCAR <https://metacpan.org/author/PERLANCAR>

        Just another implementation of UUID::Random.

        The benchmark code creates 1000+1 v4 string UUIDs.

    UUID::Random::Secure
        Author: PERLANCAR <https://metacpan.org/author/PERLANCAR>

        Just like UUID::Random, except it uses Math::Random::Secure's
        irand() to produce random numbers.

        The benchmark code creates 1000+1 v4 string UUIDs.

    Crypt::Misc
        Author: MIK <https://metacpan.org/author/MIK>

        This module from the CryptX distribution has a function to create
        and check v4 UUIDs.

        The benchmark code creates 1000+1 v4 string UUIDs.

    UUID
        Author: JRM <https://metacpan.org/author/JRM>

        This module generates DCE-compatible UUIDs, which according to RFC
        belongs to the legacy variants.

        The benchmark creates 1000+1 random UUIDs.

ACME::CPANMODULES FEATURE COMPARISON MATRIX
     +-------------------------+-----------+-----------+-----------+-----------+-----------+-------+-------+----------------+----------------------+---------------+
     | module                  | create_v1 | create_v2 | create_v3 | create_v4 | create_v5 | is_pp | is_xs | v4_rfc4122 *1) | v4_secure_random *2) | create_legacy |
     +-------------------------+-----------+-----------+-----------+-----------+-----------+-------+-------+----------------+----------------------+---------------+
     | Data::UUID              | yes       | yes       | no        | no        | no        | no    | yes   | N/A            | N/A                  | N/A           |
     | UUID::FFI               | yes       | no        | no        | yes       | no        | no    | yes   | yes            | no                   | N/A           |
     | UUID::Tiny              | yes       | no        | yes       | yes       | yes       | yes   | no    | yes            | no                   | N/A           |
     | UUID::Random            | no        | no        | no        | yes       | no        | yes   | no    | no             | no                   | N/A           |
     | UUID::Random::PERLANCAR | no        | no        | no        | yes       | no        | yes   | no    | yes            | no                   | N/A           |
     | UUID::Random::Secure    | no        | no        | no        | yes       | no        | yes   | no    | yes            | yes                  | N/A           |
     | Crypt::Misc             | no        | no        | no        | yes       | no        | yes   | no    | yes            | yes                  | N/A           |
     | UUID                    | no        | no        | no        | no        | no        | no    | yes   | no             | no                   | yes           |
     +-------------------------+-----------+-----------+-----------+-----------+-----------+-------+-------+----------------+----------------------+---------------+

    Notes:

    1. v4_rfc4122: Whether the generated v4 UUID follows RFC 4122
    specification (i.e. encodes variant and version information in M & N
    positions)
    2. v4_secure_random: Whether the module uses cryptographically secure
    pseudo-random number generator for v4 UUIDs

BENCHMARKED MODULES
    Version numbers shown below are the versions used when running the
    sample benchmark.

    Data::UUID 1.226

    UUID::FFI 0.11

    UUID::Tiny 1.04

    UUID::Random 0.04

    UUID::Random::PERLANCAR 0.005

    UUID::Random::Secure 0.004

    Crypt::Misc 0.078

    UUID 0.29

BENCHMARK PARTICIPANTS
    *   Data::UUID (perl_code)

        Code template:

         my $u = Data::UUID->new; $u->create for 1..1000; $u->to_string($u->create)

    *   UUID::FFI (perl_code)

        Code template:

         UUID::FFI->new_time for 1..1000; UUID::FFI->new_time->as_hex

    *   UUID::Tiny (perl_code)

        Code template:

         UUID::Tiny::create_uuid() for 1..1000; UUID::Tiny::uuid_to_string(UUID::Tiny::create_uuid())

    *   UUID::Random (perl_code)

        Code template:

         UUID::Random::generate() for 1..1000; ; UUID::Random::generate()

    *   UUID::Random::PERLANCAR::generate (perl_code)

        Code template:

         UUID::Random::PERLANCAR::generate() for 1..1000; UUID::Random::PERLANCAR::generate()

    *   UUID::Random::PERLANCAR::generate_rfc (perl_code)

        Code template:

         UUID::Random::PERLANCAR::generate_rfc() for 1..1000; UUID::Random::PERLANCAR::generate_rfc()

    *   UUID::Random::Secure::generate (perl_code)



( run in 0.591 second using v1.01-cache-2.11-cpan-39bf76dae61 )