Giter VIP home page Giter VIP logo

php-ffx's Introduction

A pure PHP implementation of Format-preserving, Feistel-based encryption (FFX).

Ported from emulbreh/pyffx.

Usage

$key = 'hello';
$alphabet = 'abcdefghijklmnopqrstuvwxyz';

$ffx = new \Katoni\FFX\Codecs\Text($key, $alphabet, 10);
$ffx->encrypt('encryption'); // string: jrsunxgmbq

$ffx = new \Katoni\FFX\Codecs\Integer($key, 4);
$ffx->encrypt('1234'); // int: 1867

php-ffx's People

Contributors

mpskovvang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

php-ffx's Issues

PHP 8.1 support

Hi, firstly thanks for porting this. Not sure if you are still updating?

On PHP 8.1, there is a deprecation warning

Deprecated: Implicit conversion from float 2.5 to int loses precision in vendor\katoni\php-ffx\src\FFX.php on line 68
Deprecated: Implicit conversion from float 2.5 to int loses precision in vendor\katoni\php-ffx\src\FFX.php on line 69

It seems to be caused by the casting wasn't properly enclosed in brackets on line 65. Changing it to the following fixes the problem:
$s = (int) (count($v) / 2);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.