PHPackages                             teakowa/cryptomute - 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. teakowa/cryptomute

ActiveLibrary[Security](/categories/security)

teakowa/cryptomute
==================

Encrypt numeric data (binary, decimal, hex) preserving it's format (eg. 16-digits card number to 16-digits encrypted number).

v1.5.0(3y ago)428.1k↓33.3%3Apache-2.0PHPPHP ^8.0CI passing

Since Feb 17Pushed 2mo agoCompare

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

READMEChangelog (6)Dependencies (3)Versions (15)Used By (3)

Cryptomute [![Tests](https://github.com/Teakowa/cryptomute/actions/workflows/tests.yml/badge.svg)](https://github.com/Teakowa/cryptomute/actions/workflows/tests.yml)
=====================================================================================================================================================================

[](#cryptomute-)

A small PHP class implementing Format Preserving Encryption via Feistel Network.

[![Latest Version on Packagist](https://camo.githubusercontent.com/eca56603bb05cc922255f9671e77d3a66a32158938d5e13cc9482274aca22cb2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7465616b6f77612f63727970746f6d7574652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/teakowa/cryptomute)[![PHP from Packagist](https://camo.githubusercontent.com/452049ce5ec3737348d3f43467b055f4e5f2040b056444c19dec72def3231504/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7465616b6f77612f63727970746f6d7574653f7374796c653d666c61742d737175617265)](https://packagist.org/packages/teakowa/cryptomute)[![LICENSE](https://camo.githubusercontent.com/e6257f9c8af0b485f331e3b31b6e6d10dba910e451b2f5b7bdadfa28d0bb56a4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4170616368652d2d322e302d677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![LICENSE](https://camo.githubusercontent.com/c613fa8a331ccbe74fcf817bb6e5f42fba7bad4d71a0f273be5bd868bebd7214/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d416e74692532303939362d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/996icu/996.ICU/blob/master/LICENSE)[![996.icu](https://camo.githubusercontent.com/4fbb402a9a9db6e0a9bc62076d2075ebe16e803956309bfbe825f2fa59cf3d19/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c696e6b2d3939362e6963752d7265642e7376673f7374796c653d666c61742d737175617265)](https://996.icu)[![Total Downloads](https://camo.githubusercontent.com/5575893d0fc591caa439cd7c4a49d72d5b618b4a06c412fa9fb6a71a5cf0c654/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7465616b6f77612f63727970746f6d7574652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/teakowa/cryptomute)

1. Installation
---------------

[](#1-installation)

You can install Cryptomute via [Composer](http://getcomposer.org) (packagist has [teakowa/cryptomute](https://packagist.org/packages/teakowa/cryptomute) package). In your `composer.json` file use:

```
{
    "require": {
        "teakowa/cryptomute": "^1.4"
    }
}
```

And run: `php composer.phar install`. After that you can require the autoloader and use Cryptomute:

2. Usage
--------

[](#2-usage)

```
use Cryptomute\Cryptomute;

$cryptomute = new Cryptomute(
    'aes-256-cbc',      // cipher
    '0123456789zxcvbn', // base key
    7,                  // number of rounds
);

$password = '0123456789qwerty';
$iv = '0123456789abcdef';

$plainValue = '2048';
$encoded = $cryptomute->encrypt($plainValue, 10, false, $password, $iv);
$decoded = $cryptomute->decrypt($encoded, 10, false, $password, $iv);

var_dump([
  'plainValue' => $plainValue,
  'encoded'    => $encoded,
  'decoded'    => $decoded,
]);
```

```
array(3) {
  ["plainValue"]=>
  string(4) "2048"
  ["encoded"]=>
  string(9) "309034283"
  ["decoded"]=>
  string(4) "2048"
}

```

3. Options
----------

[](#3-options)

### 3.1 Cipher

[](#31-cipher)

Cipher is the first constructor argument. Supported cipher methods are:

CipherIV`aes-128-cbc`yes`aes-192-cbc`yes`aes-256-cbc`yes`camellia-128-cbc`yes`camellia-192-cbc`yes`camellia-256-cbc`yes### 3.2 Key

[](#32-key)

Key is the second constructor argument. Base key from which all round keys are derrived.

### 3.3 Rounds

[](#33-rounds)

Rounds is the third constructor argument. Must be an odd integer greater or equal to 3. More rounds is more secure, but also slower. Recommended value is at least 7.

4. Public methods
-----------------

[](#4-public-methods)

### 4.1 setValueRange(`$minValue`, `$maxValue`)

[](#41-setvaluerangeminvalue-maxvalue)

Sets minimum and maximum values. If the result is out of range it will be re-encrypted (or re-decrypted) until output is in range.

### 4.2 encrypt(`$plainValue`, `$base`, `$pad`, `$password`, `$iv`)

[](#42-encryptplainvalue-base-pad-password-iv)

Encrypts data. Takes following arguments:

- `$plainValue` (string) input data to be encrypted
- `$base` (int) input data base, accepted values is 2 (binary), 10 (decimal) or 16 (hexadecimal)
- `$pad` (bool) pad left output to match `$maxValue`'s length?
- `$password` (string) encryption password
- `$iv` (string) initialization vector - only if cipher requires it

### 4.2 decrypt(`$cryptValue`, `$base`, `$pad`, `$password`, `$iv`)

[](#42-decryptcryptvalue-base-pad-password-iv)

Decrypts data. Takes following arguments:

- `$cryptValue` (string) input data to be decrypted
- `$base` (int) input data base, accepted values is 2 (binary), 10 (decimal) or 16 (hexadecimal)
- `$pad` (bool) pad left output to match `$maxValue`'s length?
- `$password` (string) encryption password
- `$iv` (string) initialization vector - only if cipher requires it

LICENSE
-------

[](#license)

The code in this repository, unless otherwise noted, is under the terms of both the [Anti 996](https://github.com/996icu/996.ICU/blob/master/LICENSE) License and the Apache License (Version 2.0).

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance56

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 87.6% 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 ~211 days

Recently: every ~221 days

Total

13

Last Release

1194d ago

PHP version history (6 changes)v1.0.0PHP ^5.4 || ^7.0

v1.0.2PHP ~5.4 || ~7.0

v1.0.3PHP ^5.6.1 || ~7.0

v1.1.0PHP ^7.2.5

v1.4.2PHP ^7.2.5 | ^8.0

v1.4.3PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a4d2045a2050b2bc892d20b35784b82d37ee456e914d05ddf132ec349dea7e6?d=identicon)[teakowa](/maintainers/teakowa)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (149 commits)")[![loostro](https://avatars.githubusercontent.com/u/39191878?v=4)](https://github.com/loostro "loostro (13 commits)")[![Teakowa](https://avatars.githubusercontent.com/u/27560638?v=4)](https://github.com/Teakowa "Teakowa (7 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")

---

Tags

encryptionformat-preserving-encryptionfpephpphp-libraryphp8encryptdecryptencodedecodeobfuscateformat-preservingcryptomutepermute

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/teakowa-cryptomute/health.svg)

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

###  Alternatives

[nzo/url-encryptor-bundle

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

961.0M2](/packages/nzo-url-encryptor-bundle)[xxtea/xxtea

XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for PHP.

11341.7k](/packages/xxtea-xxtea)[miladrahimi/phpcrypt

Encryption, decryption, and hashing tools for PHP projects

3171.5k2](/packages/miladrahimi-phpcrypt)[hemiframe/php-aes

PHP class for encrypt and decrypt data with AES algorithm

1030.3k](/packages/hemiframe-php-aes)

PHPackages © 2026

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