HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
paragonie
random_compat
PHP2015–2017
paragonie / random_compat

random_compat

PHP 5.x support for random_bytes() and random_int()

3Distinct people
17Mentions
0Explicit recommenders
8.2KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

PHP 5.x support for random_bytes() and random_int()

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by month17 dated mentions

Observed mentions: 2015-07-11 05:27:11 UTC to 2017-02-06 22:02:55 UTC.

0123452015-07-01 00:00:00 UTC to 2015-08-01 00:00:00 UTC (exclusive): 5 mentions; 3 submissions, 2 commentsJul 20152015-08-01 00:00:00 UTC to 2015-09-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2015-09-01 00:00:00 UTC to 2015-10-01 00:00:00 UTC (exclusive): 2 mentions; 2 submissions, 0 comments2015-10-01 00:00:00 UTC to 2015-11-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2015-11-01 00:00:00 UTC to 2015-12-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2015-12-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-01-01 00:00:00 UTC to 2016-02-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-02-01 00:00:00 UTC to 2016-03-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2016-03-01 00:00:00 UTC to 2016-04-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-04-01 00:00:00 UTC to 2016-05-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsApr 20162016-05-01 00:00:00 UTC to 2016-06-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-06-01 00:00:00 UTC to 2016-07-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-07-01 00:00:00 UTC to 2016-08-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-08-01 00:00:00 UTC to 2016-09-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-09-01 00:00:00 UTC to 2016-10-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-10-01 00:00:00 UTC to 2016-11-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-11-01 00:00:00 UTC to 2016-12-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-01 00:00:00 UTC to 2017-02-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-02-01 00:00:00 UTC to 2017-03-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 commentsFeb 2017

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Jul 20152015-07-01 00:00:00 UTC2015-08-01 00:00:00 UTC532
Aug 20152015-08-01 00:00:00 UTC2015-09-01 00:00:00 UTC211
Sep 20152015-09-01 00:00:00 UTC2015-10-01 00:00:00 UTC220
Oct 20152015-10-01 00:00:00 UTC2015-11-01 00:00:00 UTC000
Nov 20152015-11-01 00:00:00 UTC2015-12-01 00:00:00 UTC000
Dec 20152015-12-01 00:00:00 UTC2016-01-01 00:00:00 UTC101
Jan 20162016-01-01 00:00:00 UTC2016-02-01 00:00:00 UTC000
Feb 20162016-02-01 00:00:00 UTC2016-03-01 00:00:00 UTC202
Mar 20162016-03-01 00:00:00 UTC2016-04-01 00:00:00 UTC101
Apr 20162016-04-01 00:00:00 UTC2016-05-01 00:00:00 UTC000
May 20162016-05-01 00:00:00 UTC2016-06-01 00:00:00 UTC101
Jun 20162016-06-01 00:00:00 UTC2016-07-01 00:00:00 UTC101
Jul 20162016-07-01 00:00:00 UTC2016-08-01 00:00:00 UTC000
Aug 20162016-08-01 00:00:00 UTC2016-09-01 00:00:00 UTC000
Sep 20162016-09-01 00:00:00 UTC2016-10-01 00:00:00 UTC000
Oct 20162016-10-01 00:00:00 UTC2016-11-01 00:00:00 UTC000
Nov 20162016-11-01 00:00:00 UTC2016-12-01 00:00:00 UTC000
Dec 20162016-12-01 00:00:00 UTC2017-01-01 00:00:00 UTC000
Jan 20172017-01-01 00:00:00 UTC2017-02-01 00:00:00 UTC000
Feb 20172017-02-01 00:00:00 UTC2017-03-01 00:00:00 UTC202

What Hacker News says

17 sources
> This is something that I would love to see happen with open source projects: That won't happen. But not for lack of trying! My consulting company, Paragon Initiative Enterprises, has produced over a dozen high quality open source projects that make it easier to write secure PHP software. For starters, we wrote an entire CMS that has secure automatic updates baked into its core as a first-class feature (including for extension developers): https://paragonie.com/project/airship Worried about SQL injection? EasyDB makes it easy and intuitive to use prepared statements. https://github.com/paragonie/easydb Need Content-Security-Policy headers quickly and easily? You want CSP-Builder: https://paragonie.com/project/csp-builder Want all the security of libsodium with an even simpler interface and a separate class for dealing with the filesystem
Read the rest
? Check out Halite: https://paragonie.com/project/halite Want to stop CSRF (including replay attacks)? https://github.com/paragonie/anti-csrf Want to quickly examine the differences between two PHP Archives (e.g. for reproducible builds)? https://github.com/paragonie/pharaoh We even wrote the community's accepted interface for generating cryptographically secure random numbers in PHP 5 projects: https://github.com/paragonie/random_compat And coming soon (pending an audit), a pure-PHP implementation of libsodium that will likely be adopted by WordPress so its automatic updates are Ed25519 secured: https://github.com/paragonie/sodium_compat And even more: https://paragonie.com/projects Guess how many clients we've gotten from all this open source software we wrote over the past two years that demonstrably improves the security posture of software written in PHP? Zero. My solution: Our next project isn't going to be OSS, and it's unlikely that any of our future ones will be unless it's intended to be a giveaway. The open source + consulting business model may sound good in theory, but it simply doesn't work. (Though, I will grant that it's possible that the "consulting about someone else's open source project" is more sustainable, due to near-zero investment in said project itself.)
In Sandstorm is returning to its community roots
SEEKING WORK | REMOTE | Orlando, FL Need to shore up the security of your web-based software? Need someone who can work within real-world security requirements? PHP powers over 82% of websites on the Internet today, though it's often shunned by other information security professionals. For most companies, rewriting everything from scratch in a different language is not a viable strategy for minimizing the risk to themselves or their customers. Is it possible for software written in PHP to be secure (in spite of what other security experts say)? Yes. If you still have doubts, get in touch. My research and professional background mostly consists of software development, web application security, applied cryptography, code auditing, and penetration testing. You may find much of my recent open source security research here: https://paragonie.
Read the rest
com/security/advisories A sample of PHP projects I've developed or contributed to significantly: - random_compat - PHP 5 polyfill for the CSPRNG functions introduced in PHP 7; this security library has over 19 million installs according to Packagist - https://github.com/paragonie/random_compat - sodium_compat - A pure-PHP implementation of much of modern elliptic curve cryptography and (AEAD) symmetric encryption - https://github.com/paragonie/sodium_compat - CMS Airship - A secure-by-default content management system - https://paragonie.com/project/airship - CSP-Builder - A developer utility to promote the adoption of Content-Security-Policy headers - https://github.com/paragonie/csp-builder I can be reached via https://paragonie.com/contact or email: security@paragonie.com
In Ask HN: Freelancer? Seeking freelancer? (February 2017)
I have an anecdote to support your comment: One of the more valuable tools I've worked on was random_compat. Over 6 million Packagist downloads and has been integrated in all the major frameworks that still support PHP 5. https://github.com/paragonie/random_compat https://packagist.org/packages/paragonie/random_compat Despite being incredibly useful tool, there isn't a lot of active development going on. It just works, and when it doesn't, it's because your operating environment is borked. Paying per commit wouldn't make sense for us. We have very little technical debt.
In Ask HN: Patreon for open source?
SEEKING WORK: Application Security, Cryptography, Web Development REMOTE Only - (Located in Orlando, FL) What do WordPress, Joomla, Symfony, CodeIgniter, the Facebook SDK, CakePHP, Yii Framework, several implementations of RNCryptor in various programming languages, and Zend Framework's Cryptography Library all have in common? They've all benefited from my open source security research. Whether you're a startup looking to eliminate unnecessary risk while you focus on growth or a large business that needs to protect your assets, I can help. A brief sample of software I've written: * https://github.com/paragonie/halite - Halite: A PHP libsodium wrapper that emphasizes ease-of-use, secure defaults, and type-safety. * https://github.com/paragonie/random_compat Random_compat: Use the new PHP 7 CSPRNG functions in PHP 5 projects. * https://gith
Read the rest
ub.com/paragonie/constant_time_encoding - Constant-Time Encoding: A full implementation of RFC 4648 encoding/decoding functions that can be used to encode encryption keys for storage without leaking key material through cache-timing side-channels. * https://github.com/paragonie/csp-builder - CSP Builder: Build a Content-Security-Policy header for your website. Example config: https://github.com/paragonie/airship/blob/master/src/config/... Live demo: https://securityheaders.io/?q=https%3A%2F%2Fcspr.ng%2F * https://github.com/paragonie/airship - CMS Airship (beta software): A secure-by-default content management system and development framework that emphasizes secure package management and attempts to solve the Triangle of Secure Code Delivery: https://defuse.ca/triangle-of-secure-code-delivery.htm Other Technologies: * Excellent: PHP, Java, C#, Shell scripting * Experienced: HTML5/CSS3/JS, Node.js, C, C++, Python (with Django), Webserver configuration (Apache/nginx) * Currently learning: Ruby [on Rails] Feel free to contact me at security@paragonie.com if you're interested in working together.
In Ask HN: Freelancer? Seeking freelancer? (May 2016)
You have two choices then: - Use RSA until 25519/448 land in TLS - Switch to ECDSA in the interim Personally, I would switch even though ECDSA isn't great. The concerns over P-256 and P-384 are more academic than anything: They're hard to implement safely and without side-channels. Read: hard, not impossible. You shouldn't be writing your own ECDSA implementation, however. That'd be foolhardy. EDIT: I use secp384r1 for signing random_compat, so if anyone gets bit by this recommendation, I will too: https://github.com/paragonie/random_compat/blob/master/dist/...
In The DROWN Attack
> Apologies if my comment came off as accusatory, I really did find it funny This thread has been a land mine of accusatory reactions, so I apologize for painting yours in a similar brush. > I have seen people have a bias towards the quality of open-source software even though the closed-source alternative is opaque Reverse engineering isn't hard, it's just a speed-bump. I work on a lot of open source projects. At the risk of sounding self-promotional to on-lookers, I'd like to talk about one in particular: https://github.com/paragonie/random_compat https://packagist.org/packages/paragonie/random_compat Random_compat has been downloaded almost 2 million times (according to Packagist), incorporated into WordPress, Laravel, Symfony, etc. It's by far the most collaborative project that Paragon Initiative Enterprises has produced for the ope
Read the rest
n source community. Yet, until the most recent release, the documentation referred to a MCRYPT_CREATE_IV constant that does not exist. The correct constant is MCRYPT_DEV_URANDOM. Somehow, we all missed it. "Open source is automatically more secure" is a fallacy. I just happen to like open source better, personally. Aside: despite being downloaded ~1.9 million times, a grand total 30 people outside of Paragon have contributed to its development in some way so far. The "many eyes" are actually quite sparse, especially when it comes to security expertise. (I think it's reasonable to say those 30 represent much of the the upper 0.01% of security talent in the PHP community.)
In GitHub is apparently in crisis again
Hi tryingToGeek, I do a lot of open source security research. Some of the most dangerous vulnerabilities I've found were addressed by a very small change to the code. Should I discount them because they aren't significant or substantial? Of course not. Why should your contributions be any different? In my projects, I go out of my way to thank people regardless of how much they contribute. See https://github.com/paragonie/random_compat for example. Some of the peoples' names are there because they led the way towards great architectural changes that improved the reliability, readability, or performance of this library. Others, for pointing out (and maybe fixing) typos that made it confusing. In all cases, I'm grateful that anyone took the time to help make something I wrote better, and the end result is that this project should be better f
Read the rest
or the community to use. How does that relate to your situation? Simple: Your contributions are valuable. Whether or not anyone recognizes them as valuable reflects on their value, not yours. Just something to keep in mind.
In Ask HN: Can I be happy on small things done to the community?
Correct, that's the edge case where it actually falls together neatly. If you're starting with a random byte and charset.length is an even power of 2, you end up with no bias. It's better to design functions like this to discard values outside of an acceptable range and try again until they generate a safe value (also, apply a & bit mask to reduce the number of retries). This allows you to accept any arbitrary charset size without being concerned about security. See also: https://github.com/paragonie/random_compat/blob/5aa6689651a5... I'll open a PR tonight if nobody beats me to it.
In Encryptr – Free, open-source password manager and e-wallet
And that's another reason why it's a good thing that PHP 7 (coming out soon!) has a new function called random_int() which provides an unbiased distribution of integers powered by a CSPRNG (yes, it uses urandom, in case anyone asks). My employer is leading the effort to expose a compatible interface in PHP 5 applications so developers can add one line to their composer.json file and start writing code for PHP 7. It's MIT licensed and should nearing its 1.0.0 release soon. https://github.com/paragonie/random_compat
In A call to PHP's mt_rand generates only odd numbers

Showing the 15 most recent of 17 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.