NAME
Crypt::URandom::MonkeyPatch - override core rand function to use system random sources
SYNOPSIS
use Crypt::URandom::MonkeyPatch;
DESCRIPTION
This module globally overrides the builtin Perl function rand with one based on the operating system's cryptographic
random number source, e.g. /dev/urandom.
The purpose of this module is monkey patch legacy code that uses rand for security purposes.
You can verify that it is working by running code with the CRYPT_URANDOM_MONKEYPATCH_DEBUG environment variable set,
e.g.
local $ENV{CRYPT_URANDOM_MONKEYPATCH_DEBUG} = 1;
my $salt = random_string("........");
Every time the rand function is called, it will output a line such as
Crypt::URandom::MonkeyPatch::urandom used from Some::Package line 123
RECENT CHANGES
Changes for version v0.1.3 (2025-09-14)
- Bug Fixes
- Use print instead of say when CRYPT_URANDOM_MONKEYPATCH_DEBUG is enabled.
See the Changes file for more details.
REQUIREMENTS
This module lists the following modules as runtime dependencies:
See the cpanfile file for the full list of prerequisites.
INSTALLATION
The latest version of this module (along with any dependencies) can be installed from CPAN with the cpan tool that is included with Perl:
cpan Crypt::URandom::MonkeyPatch
You can also extract the distribution archive and install this module (along with any dependencies):
cpan .
You can also install this module manually using the following commands:
perl Makefile.PL
make
make test
make install
If you are working with the source repository, then it may not have a Makefile.PL file. But you can use the Dist::Zilla tool in anger to build and install this module:
dzil build
dzil test
dzil install --install-command="cpan ."
For more information, see How to install CPAN modules.
SUPPORT
Only the latest version of this module will be supported.
Only Perl versions released in the past ten (10) years are supported, even though this module may run on earlier versions.
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.
Reporting Security Vulnerabilities
Security issues should not be reported on the bugtracker website. Please see SECURITY.md for instructions how to
report security vulnerabilities.
SOURCE
The development version is on github at "robrwo/perl-Crypt-URandom-MonkeyPatch" in github.com and may be cloned from "robrwo/perl-Crypt-URandom-MonkeyPatch.git" in github.com
AUTHOR
Robert Rothenberg rrwo@cpan.org
COPYRIGHT AND LICENSE
This software is Copyright (c) 2025 by Robert Rothenberg rrwo@cpan.org.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)