Crypt::...keyPatch(3)

πŸ“¦ version 0.1.4, in fedora 43, fedora 44

πŸ’– Crypt::URandom::MonkeyPatch πŸ’–

okay bestie, so this is the Crypt::...keyPatch(3) page β€” yeah the name's a little chopped in the header, that's just how the manual file rolls, the full module is Crypt::URandom::MonkeyPatch and it lives in the User Contributed Perl Documentation section. sit down, grab a boba, we're talking about ✨randomness✨.


✨ NAME ✨

Crypt::URandom::MonkeyPatch β€” override the core rand function to use system random sources πŸ‘‘


🌸 VERSION 🌸

version v0.1.4


πŸ¦‹ SYNOPSIS πŸ¦‹

use Crypt::URandom::MonkeyPatch;

that's it. that's the whole vibe. one line and you've rewritten reality πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

So like, this module globally overrides the builtin Perl function rand with one that's based on your operating system's cryptographic random number source β€” think /dev/urandom, the good stuff. πŸ”₯

The whole purpose of this module is to monkey patch legacy code that uses rand for security purposes. Like, code from 2009 that's still out there generating salts with rand?? bestie. we gotta fix that. πŸ™ˆ

You can verify it's working by running your code with the CRYPT_URANDOM_MONKEYPATCH_DEBUG environment variable set, e.g.:

local $ENV{CRYPT_URANDOM_MONKEYPATCH_DEBUG} = 1;

my $salt = random_string("........");

Every single time the rand function gets called, it will output a line such as:

Crypt::URandom::MonkeyPatch::urandom used from Some::Package line 123

not it telling on your code like that 😭 but also... iconic for debugging.


✨ EXPORTS ✨

πŸ’œ rand

This globally overrides the builtin rand function using 31-bits of data from the operating system's random source. thirty-one bits of pure OS-grade chaos, no cap. 🌈


πŸ’€ KNOWN ISSUES πŸ’€

Okay listen, this module is NOT intended for use with new code, or for use in CPAN modules. fr fr. If you are writing new code that needs a secure source of random bytes, then use Crypt::URandom or see the CPAN Author's Guide to Random Data for Security (https://security.metacpan.org/docs/guides/random-data-for-security.html).

bestie this is a rescue mission, not a lifestyle. This should only be used when the affected code cannot be updated. πŸš‘

And because this updates the builtin function globally, it may affect other parts of your code. like, the whole entire program. every rand everywhere. it's giving main character energy and honestly it is the main character now. 🫢


🌈 SEE ALSO 🌈

  • Crypt::URandom
  • CORE
  • perlfunc

πŸ“ SOURCE πŸ“

The development version is on github at https://github.com/robrwo/perl-Crypt-URandom-MonkeyPatch and may be cloned from https://github.com/robrwo/perl-Crypt-URandom-MonkeyPatch.git

clone it bestie, it's right there 🧚


πŸ’… SUPPORT πŸ’…

Only the latest version of this module will be supported. (yes, only the newest one. upgrade or perish, sorry.)

Only Perl versions released in the past ten (10) years are supported, even though this module may run on earlier versions. so if your Perl is older than ten years... she may still run but you're on your own, gorgeous. 😭

Please report any bugs or feature requests on the bugtracker website https://github.com/robrwo/perl-Crypt-URandom-MonkeyPatch/issues

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. receipts, bestie, we need receipts 🧾✨

πŸ”’ Reporting Security Vulnerabilities

Security issues should not be reported on the bugtracker website. Please see SECURITY.md for instructions how to report security vulnerabilities. do not put a security vuln in the public issue tracker, i am begging πŸ™


πŸ‘‘ AUTHOR πŸ‘‘

Robert Rothenberg <perl@rhizomnic.com>


This software is Copyright (c) 2025-2026 by Robert Rothenberg <perl@rhizomnic.com>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

and that's the whole page, bestie!! πŸŽ€ this was Crypt::...keyPatch(3), running on perl v5.42.3, dated 2026-09-27 β€” mwah, slay, go patch responsibly πŸ’‹πŸ¦‹βœ¨

πŸ“¦ where this page comes from