PHPackages                             mmeyer2k/ralph - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. mmeyer2k/ralph

ActiveLibrary[Security](/categories/security)

mmeyer2k/ralph
==============

A semi-secure symmetric encryption library

16PHP

Since Aug 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mmeyer2k/ralph)[ Packagist](https://packagist.org/packages/mmeyer2k/ralph)[ RSS](/packages/mmeyer2k-ralph/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

ralph
=====

[](#ralph)

A semi-secure symmetric encryption library that sometimes eats crayons.

Ralph provides acceptable security in situations where size is critical. All major security parameters are 64 bit (block, iv and checksum). As a result, input strings under 8 bytes long result in a 24 byte cypher text.

```
$encrypted = ralph()::encrypt('secret', 'password');

var_dump(base64_encode($encrypted));
#string(32) "M783Db84XVPukJZkRh05R5ZBZxcD4CvM"

$decrypted = ralph()::decrypt($encrypted, 'password');

var_dump($decrypted);
#string(6) "secret"
```

Ralph isn't very smart, so he registers himself the in global namespace `\Ralph`. He also registers the global helper function `ralph()`, for your convenience and amusement.

install
-------

[](#install)

**EXPERIMENTAL**

Ralph is compatible with PHP versions 7.1 to 8.1.

```
composer require mmeyerk/ralph main-dev
```

how it works
------------

[](#how-it-works)

Ralph uses `hash_pbkdf2()` to generate a key stream which is then XORed with the message. Both `encrypt` and `decrypt` functions accept an optional third parameter to specify iterations for key hardening.

```
$iterations = 10000;
$encrypted = ralph()::encrypt('secret', 'password', $iterations);
$decrypted = ralph()::decrypt($encrypted, 'password', $iterations);
```

specs
-----

[](#specs)

- initialization vector (`random_bytes`)
- time-safe checksum verification (`hash_equals`, `hash_hmac`, `sha3-256`)
- block padding (`PKCS#7`)
- key stream generation (`hash_pbkdf2`, `sha3-512`)

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c39fe5f8d80dda8a5735401c12cb631d5e17050f7baa7cd3f0f384167fb45db?d=identicon)[mmeyer2k](/maintainers/mmeyer2k)

---

Top Contributors

[![mmeyer2k](https://avatars.githubusercontent.com/u/1887431?v=4)](https://github.com/mmeyer2k "mmeyer2k (25 commits)")

### Embed Badge

![Health badge](/badges/mmeyer2k-ralph/health.svg)

```
[![Health](https://phpackages.com/badges/mmeyer2k-ralph/health.svg)](https://phpackages.com/packages/mmeyer2k-ralph)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41478.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

87117.5M63](/packages/bjeavons-zxcvbn-php)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)[paragonie/hidden-string

Encapsulate strings in an object to hide them from stack traces

7410.6M39](/packages/paragonie-hidden-string)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
