UUID::URandom(3pm)
β¨ NAME β¨
UUID::URandom β it makes UUIDs out of /dev/urandom or the Windows Crypto API π (it's a perl module, manual page UUID::URandom(3pm), iykyk)
π VERSION π
version 0.001
πΈ SYNOPSIS πΈ
use UUID::URandom qw/create_uuid/;
my $uuid = create_uuid();
π¦ DESCRIPTION π¦
Okay bestie, so this module is your portable, secure generator of RFC-4122 version 4 (random) UUIDs β¨ β that's the spec over at <https://tools.ietf.org/html/rfc4122> if you wanna read the source material.
It's literally just a thin wrapper around Crypt::URandom that does one very specific job: setting the UUID version and variant bits that the RFC says you gotta have. That's it. That's the whole personality. And it ate. π
π USAGE π
No functions are exported by default. None. Zero. You have to ask nicely (with qw/.../) β no cap.
π«Ά FUNCTIONS π«Ά
β create_uuid
my $uuid = create_uuid();
# "\x95\x5a\xe4\x96\x8b\xb2\x45\x0b\x9c\x7e\x99\xf5\x01\xdf\x90\xfe"
This one returns a brand new UUID as a 16 byte 'binary' string. Just raw bytes, no thoughts, no formatting. π
β create_uuid_hex
my $uuid = create_uuid_hex();
# "955ae4968bb2450b9c7e99f501df90fe"
This one returns a new UUID as a 32-byte hexadecimal string. Hex girlies rise. π
β create_uuid_string
my $uuid = create_uuid_string();
# "955ae496-8bb2-450b-9c7e-99f501df90fe"
This one gives you a new UUID in the 36-byte RFC-4122 canonical string representation. It's giving the classic UUID look. π
N.B. the canonical representation is lower-case. Lowercase only, bestie β don't come at it with caps.
π§ FORK AND THREAD SAFETY π§
The underlying Crypt::URandom is believed to be fork and thread safe. Believed!! That's the level of confidence we're working with here. π«
π₯ SEE ALSO π₯
There are a number of other modules out there that provide version 4 UUIDs too. Many of them rely on insecure or non-crypto-strength random number generators, which is... a choice. π Anyway, the roster:
Data::GUID::AnyData::UUID::LibUUIDUUIDUUID::TinyData::UUID::MT
π SUPPORT π
π Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker at <https://github.com/dagolden/UUID-URandom/issues>. You will be notified automatically of any progress on your issue β so like, you won't be left on read. π«Ά
πΈ Source Code
This is open source software. The code repository is available for public review and contribution under the terms of the license.
<https://github.com/dagolden/UUID-URandom>
git clone https://github.com/dagolden/UUID-URandom.git
π AUTHOR π
David Golden <dagolden@cpan.org>
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2018 by David Golden.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
And that's the whole page, bestie β perl v5.36.0, dated 2022-11-19, straight from the UUID::URandom(3pm) manual. Go make some unguessable UUIDs, mwah π
β¨
π¦ where this page comes from
- debian bookworm: libuuid-urandom-perl 0.001-2 Β· Apache-2.0
- debian trixie: libuuid-urandom-perl 0.001-2 Β· Apache-2.0
- ubuntu noble: libuuid-urandom-perl 0.001-2 Β· Apache-2.0
- ubuntu resolute: libuuid-urandom-perl 0.001-2 Β· Apache-2.0
- ubuntu stonking: libuuid-urandom-perl 0.001-2 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms