UUID4::Tiny

Latest version: 0.003 registry icon
Maintenance score
0
Safety score
0
Popularity score
14
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
0.003 0 0 0 0 0
0.002 0 0 0 0 0
0.001 0 0 0 0 0

Stability
Latest release:

0.003 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

GPL-1.0-or-later   -   GNU General Public License v1.0 or later

Not a wildcard

Not proprietary

OSI Compliant


Artistic-1.0   -   Artistic License 1.0

Not a wildcard

Not proprietary

OSI Compliant



Test

NAME

UUID4::Tiny - Cryptographically secure v4 UUIDs for Linux x64

VERSION

version 0.003

SYNOPSIS

use UUID4::Tiny qw/
   create_uuid
   create_uuid_string
   is_uuid_string
   is_uuid4_string
   string_to_uuid
   uuid_to_string
   /;

my $uuid        = create_uuid;
my $uuid_string = create_uuid_string;

$uuid        = string_to_uuid $uuid_string;
$uuid_string = uuid_to_string $uuid;

if ( is_uuid4_string $uuid_string ) { ... }

DESCRIPTION

Uses the Linux getrandom() system call to generate a version 4 UUID.

Requires Linux kernel 3.17 or newer for getrandom().

FUNCTIONS

create_uuid

my $uuid = create_uuid;

Gets a series of 16 random bytes via the getrandom() system call and sets the UUID4 version and variant on those bytes. Dies with a message containing the errno if the call to getrandom() fails.

uuid_to_string

my $uuid_string = uuid_to_string( create_uuid );

Converts a 16 byte UUID to a canonical 8-4-4-4-12 format UUID string.

Calling this function on a string that is already a UUID string will return the string unmodified, and raise a warning.

Calling this function on a reference is almost certainly not what you want, as the function would naively try to unpack the stringified reference, e.g. ARRAY(0xdeadbeef1234), into a UUID string. For this reason, the function will croak if its input is a reference.

create_uuid_string

my $uuid_string = create_uuid_string;

Shortcut for uuid_to_string called on create_uuid.

string_to_uuid

my $uuid = string_to_uuid( $uuid_string );

Converts a canonical 8-4-4-4-12 format UUID string to a 16 byte UUID.

is_uuid_string

if ( is_uuid_string( $input ) ) { ... }

Checks if the input matches the canonical 8-4-4-4-12 format.

is_uuid4_string

if ( is_uuid4_string( $input ) ) { ... }

Similar to is_uuid_string, additionaly checking that the variant and version are correct for UUID v4.

SEE ALSO

AUTHOR

CV-Library cvlibrary@cpan.org

COPYRIGHT AND LICENSE

This software is copyright (c) 2019 by CV-Library.

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