awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
paragonie avatar

paragonie/random_compat

0
View on GitHub↗
8,165 stars·148 forks·PHP·MIT·14 viewsparagonie.com/projects↗

Random Compat

random_compat is a backward-compatibility library that provides cryptographically secure random number generation functions for PHP 5.x environments. It delivers the random_bytes() and random_int() functions that are natively available in PHP 7+, enabling legacy applications to generate secure random bytes and unbiased integers from system entropy sources.

The library implements a priority-based fallback chain across operating-system CSPRNGs, selecting the best available random source in order of security. It uses rejection sampling to convert raw random bytes into unbiased integers within arbitrary ranges, eliminating modulo bias. When no secure random source is available, the library throws explicit exceptions to make failure modes clear to developers.

The polyfill defines its functions only when the native PHP 7+ equivalents are absent, preventing redeclaration errors in mixed-version environments. It wraps multiple OS-level random number generators behind a unified interface, hiding platform-specific differences from callers. The library exposes procedural functions that internally delegate to static class methods, maintaining PHP 5.x compatibility without breaking modern call patterns.

Features

  • Cryptographic Random Number Generators - Generates unbiased random bytes and integers from system entropy sources for security-sensitive operations.
  • Cryptographic Integer Scaling - Converts raw random bytes into unbiased integers within arbitrary ranges using rejection sampling.
  • Fallback Chains - Selects the best available random source by trying OS-level CSPRNGs in order of security.
  • Priority-Based CSPRNG - Selects the best available operating-system random source through a security-prioritized fallback chain.
  • Unbiased Random Integer Generators - Produces unbiased random integers within arbitrary ranges using rejection sampling to avoid modulo bias.
  • Cross-Platform Abstractions - Wraps multiple OS-level CSPRNGs behind a unified interface, hiding platform-specific differences from callers.
  • Backward Compatibility Libraries - Delivers secure random number generation functions to PHP 5.x applications that cannot use PHP 7+ native implementations.
  • PHP 5.x Compatibility Polyfills - Provides cryptographically secure random byte and integer generation functions for PHP 5.x environments.
  • PHP 5.x CSPRNG Polyfills - Provides cryptographically secure randombytes() and randomint() functions for legacy PHP 5.x environments.
  • PHP 5.x Random Function Compatibility - Provides cryptographically secure random number generation functions for legacy PHP 5.x applications.

Star history

Star history chart for paragonie/random_compatStar history chart for paragonie/random_compat

How this analysis was created: This summary and feature list were written by an AI model that read the project's README and public documentation pages. Each feature links to the documentation it came from; stars, license and language come straight from the GitHub API. The model does not read the source code, and the analysis is refreshed when the project is re-analysed. Learn more on our About page.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Open-source alternatives to Random Compat

Similar open-source projects, ranked by how many features they share with Random Compat.
  • kelektiv/node-uuidkelektiv avatar

    kelektiv/node-uuid

    15,297View on GitHub↗

    node-uuid is a JavaScript library for generating and validating universally unique identifiers that comply with the RFC 4122 standard. It provides a utility for creating random, timestamp-based, or namespace-based identifiers within a Node.js environment. The library includes tools for detecting the specific standard version of a provided identifier and transforming identifiers between different versions. It also provides a command line utility for generating identifiers directly from the terminal. The project covers binary manipulation, including parsing strings into byte arrays and stringi

    TypeScript
    View on GitHub↗15,297
  • digitalbazaar/forgedigitalbazaar avatar

    digitalbazaar/forge

    5,311View on GitHub↗

    Forge is a JavaScript cryptography library providing a comprehensive set of tools for symmetric and asymmetric encryption, hashing, and digital signatures. It includes a full Transport Layer Security implementation for establishing secure network connections and managing encrypted traffic. The project implements a wide array of public key infrastructure tools, including X.509 certificate management, the generation of certificate signing requests, and the validation of certificate chains. It provides a PKCS cryptographic toolkit for handling secure archives and signed messages, alongside suppo

    JavaScript
    View on GitHub↗5,311
  • briansmith/ringbriansmith avatar

    briansmith/ring

    4,091View on GitHub↗

    Ring is a low-level cryptographic primitive library and security toolset designed for building portable, secure applications. It provides a collection of implementations for RSA, elliptic curve cryptography, and authenticated symmetric encryption. The project focuses on constant-time cryptography to prevent secret data from leaking through timing side-channel attacks. It utilizes a formal verification tool that generates arithmetic logic from templates, ensuring mathematical correctness and eliminating manual implementation errors. The library includes capabilities for producing cryptographi

    Assembly
    View on GitHub↗4,091
  • lucia-auth/lucialucia-auth avatar

    lucia-auth/lucia

    10,461View on GitHub↗

    Lucia is an authentication library that provides session management, OAuth integration, and password-based login for web applications. It creates and validates server-side sessions using cryptographically random tokens stored in HttpOnly, Secure, SameSite=Lax cookies, with constant-time token comparison to prevent timing side-channel attacks. The library supports authentication through email and password, GitHub OAuth, Google OAuth, and passkey-based sign-in. It enforces two-factor authentication using time-based one-time passwords (TOTP) from authenticator apps, generates recovery codes for

    authoauthtypescript
    View on GitHub↗10,461
See all 30 alternatives to Random Compat→

Frequently asked questions

What does paragonie/random_compat do?

randomcompat is a backward-compatibility library that provides cryptographically secure random number generation functions for PHP 5.x environments. It delivers the randombytes() and random_int() functions that are natively available in PHP 7+, enabling legacy applications to generate secure random bytes and unbiased integers from system entropy sources.

What are the main features of paragonie/random_compat?

The main features of paragonie/random_compat are: Cryptographic Random Number Generators, Cryptographic Integer Scaling, Fallback Chains, Priority-Based CSPRNG, Unbiased Random Integer Generators, Cross-Platform Abstractions, Backward Compatibility Libraries, PHP 5.x Compatibility Polyfills.

What are some open-source alternatives to paragonie/random_compat?

Open-source alternatives to paragonie/random_compat include: satori/go.uuid — This is a Go library for generating and parsing universally unique identifiers. It provides a programmatic way to… lucia-auth/lucia — Lucia is an authentication library that provides session management, OAuth integration, and password-based login for… kelektiv/node-uuid — node-uuid is a JavaScript library for generating and validating universally unique identifiers that comply with the… digitalbazaar/forge — Forge is a JavaScript cryptography library providing a comprehensive set of tools for symmetric and asymmetric… briansmith/ring — Ring is a low-level cryptographic primitive library and security toolset designed for building portable, secure… segmentio/ksuid — ksuid is a Go implementation of k-sortable unique identifiers. It provides a system for generating globally unique…