PHPackages                             ivinco/crypto-ff3 - 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. ivinco/crypto-ff3

ActiveLibrary[Security](/categories/security)

ivinco/crypto-ff3
=================

Format-Preserving Encryption for FF3 on PHP

1.1(1y ago)2231MITPHPPHP &gt;=8.0

Since Aug 22Pushed 1y agoCompare

[ Source](https://github.com/Ivinco/crypto-ff3-php)[ Packagist](https://packagist.org/packages/ivinco/crypto-ff3)[ RSS](/packages/ivinco-crypto-ff3/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

FF3Cipher PHP Library
=====================

[](#ff3cipher-php-library)

Overview
--------

[](#overview)

FF3Cipher is a PHP implementation of the FPE (Format-Preserving Encryption) algorithm.

Unlike other PHP implementations, this library is capable of working with `multibyte`character dictionaries.

With the growth of data protection needs and the wide adoption of PHP in web applications, this project aims to bridge the gap, allowing developers to utilize FF3 encryption easily within their PHP applications.

Installation
------------

[](#installation)

The recommended way to install FF3Cipher is through Composer:

```
composer require ivinco/crypto-ff3
```

Ensure your project's composer.json and the associated lock file are updated.

Usage
-----

[](#usage)

### Basic Encryption &amp; Decryption

[](#basic-encryption--decryption)

```
use Ivinco\Crypto\FF3Cipher;

$key = "EF4359D8D580AA4F7F036D6F04FC6A94"; // Your encryption key
$tweak = "D8E7920AFA330A73"; // Your tweak

$cipher = new FF3Cipher($key, $tweak);

$plaintext = "1234567890";
$ciphertext = $cipher->encrypt($plaintext);
echo "Ciphertext: " . $ciphertext . PHP_EOL;

$decrypted = $cipher->decrypt($ciphertext);
echo "Decrypted: " . $decrypted . PHP_EOL;
```

### Using Custom Alphabets

[](#using-custom-alphabets)

In some scenarios, you might want to work with non-standard characters. This library supports encryption and decryption using custom alphabets:

```
$alphabet = "abcdefghijklmnopqrstuvwxyz"; // Custom alphabet
$cipher = FF3Cipher::withCustomAlphabet($key, $tweak, $alphabet);

$plaintext = "wfmwlrorcd";
$ciphertext = $cipher->encrypt($plaintext);
echo "Ciphertext: " . $ciphertext . PHP_EOL; // ywowehycyd

$decrypted = $cipher->decrypt($ciphertext); // wfmwlrorcd
echo "Decrypted: " . $decrypted . PHP_EOL;
```

Tests
-----

[](#tests)

The library is accompanied by unit tests.

Install the required packages via Composer:

```
composer install
```

Execute PHPUnit:

```
./vendor/bin/phpunit
```

Links
-----

[](#links)

For FF3 implementations in other languages, you can refer to:

- [Python Version](https://github.com/mysto/python-fpe)
- [Node.js Version](https://github.com/mysto/node-fpe)
- [Java Version](https://github.com/mysto/java-fpe)
- [C Version](https://github.com/mysto/clang-fpe)

For more information about FF3, you can refer to:

-
-

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~268 days

Total

2

Last Release

725d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e280c3cc6fb9bdc50944f8265dac5a2accd7a6b27474073a0b46cd01459d81ae?d=identicon)[pavel-ivinco](/maintainers/pavel-ivinco)

---

Top Contributors

[![EvilFreelancer](https://avatars.githubusercontent.com/u/9089568?v=4)](https://github.com/EvilFreelancer "EvilFreelancer (14 commits)")

---

Tags

decryptionencryptionfeistel-cipherff3fpephpphpencryptiondecryptionfpeff3feistel-cipher

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ivinco-crypto-ff3/health.svg)

```
[![Health](https://phpackages.com/badges/ivinco-crypto-ff3/health.svg)](https://phpackages.com/packages/ivinco-crypto-ff3)
```

###  Alternatives

[camcima/dukpt-php

DUKPT implementation in PHP

25153.1k](/packages/camcima-dukpt-php)[payu/apple-pay

ApplePay Token Decoder

51983.2k](/packages/payu-apple-pay)[poly-crypto/poly-crypto

High-level cryptographic functions that are interoperable between NodeJS and PHP 7.1+

127.8k1](/packages/poly-crypto-poly-crypto)[stymiee/php-simple-encryption

The PHP Simple Encryption library is designed to simplify the process of encrypting and decrypting data while ensuring best practices are followed. By default is uses a secure encryption algorithm and generates a cryptologically strong initialization vector so developers do not need to becomes experts in encryption to securely store sensitive data.

448.0k](/packages/stymiee-php-simple-encryption)

PHPackages © 2026

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