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 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 12:03:30 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

5 sources
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

Ask HN: Where to Learn Rudimentary Marketing Skills?

Anyone who works with me tells me they think that I'm a great programmer, but I don't know the first thing about marketing or sales. I'd like to get from "employed at a dead-end job for a sinking startup making a very humble salary with no benefits or vacation with a 4 hour daily commute" to the vicinity of "self-employed consultant working from home earning $XY,000 per week on client engagements". Where/how can I quickly learn whatever skills I'm missing? (I might be under the gun soon to come up with an answer, since rumor mill is telling me that my $dayjob is going out of business on the 1st yet $dayjob['boss'] has remained silent about this.) For the record: I'm technically not quite going 100% solo freelance consultant, a friend of mine (whom, unlike me, does not have a felony conviction for computer hacking that shuts 99% of doors)
Read the rest
started an LLC that I intend to work under full time. Our website is https://paragonie.com I've already seen a lot of Double Your Freelancing and read a bunch of 'patio11's blog posts. For those interested in knowing, my skillset covers PHP, Java, .NET, JavaScript/HTML/CSS, and Shell/batch scripting, with a specialization in application security. WHAT WE HAVE DONE SO FAR: We've performed two code audits on cryptography applications in the past two months, but I'm not yet at liberty to post the reports (although the client did agree to publication later this year). We have also started a community initiative to backport PHP 7's CSPRNG features into PHP 5 projects: https://github.com/paragonie/random_compat We also have a new post on our blog (once per week, on average) that consistently resonates with the part of the PHP developer community I can reach and, usually, explains new security concepts from a developer's perspective. Based on the feedback I've received, this is generally seen as a high value offering that lots of people benefit from. Is this a good start? Is there something I can do today that will help me reach businesses that need the skills I have to offer?
8 points · Open discussion

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.