Giter VIP home page Giter VIP logo

phpaes's People

Contributors

clphillips avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpaes's Issues

way old AES.class.php

I have your way old class from Oct 1, 2007. This older class doesn't seem to be compatible with other libraries to decrypt AES128 not was i able to just drop in this newer class to replace it. I'm thinking i need to decrypt with the older class and then re-encrypt with the newer one to get some compatibility?

AES and PHP 7.3.3

I've been using AES on PHP 5.x for some time, but now my servers are being updated to PHP 7.3.3.
I tested my existing setup on 7.3.3, and using CBC mode (which is required) validation was failing.
No error messages are shown.
I set up a test on 7.3.3 which prints out the encrypted and decrypted outputs and the decrypted output still looks encrypted
The only clue I've found relates to changes in "__construct", but I don't know enough to decide if that may be the problem.
A demo is at:
http://fyefield.com/php_aes/aes_demo.php
GeeDeeJay

Use exception instead of die

Hi,

could you please use an exception instead of die function in case the configuration contains errors?

Kind regards

Michael

Changed behaviour of old version across PHP versions

I ran into something like #4 / #8 recently when I moved an older app to new hosting; figured I'd document my process in tracking the issue down here. I was using a version of AES.class.php dated October 1, 2007, and the old hosting was PHP5.4. (Don't laugh!)

<?php

include 'Aes2007.php';
include 'Aes2018.php';

use AES as Aes2007;
use PhpAes\Aes as Aes2018;

$key = 'abcdefgh01234567';
$secret = 'Hello, world!';

$aes2007 = new Aes2007($key);
$enc2007 = $aes2007->encrypt($secret);

$aes2018 = new Aes2018($key);
$enc2018 = $aes2018->encrypt($secret);

echo 'MD5 2007: ' . md5($enc2007) . PHP_EOL;
echo 'MD5 2018: ' . md5($enc2018) . PHP_EOL;
$ for VERSION in 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 ; do echo Testing with PHP $VERSION ; docker run --rm -v `pwd`:/app php:$VERSION php /app/aes-test.php ; echo ; done
Testing with PHP 5.4
MD5 2007: f0ad7ccf34653a5229ae9ab4c9fdf8b0
MD5 2018: f0ad7ccf34653a5229ae9ab4c9fdf8b0

Testing with PHP 5.5
MD5 2007: f0ad7ccf34653a5229ae9ab4c9fdf8b0
MD5 2018: f0ad7ccf34653a5229ae9ab4c9fdf8b0

Testing with PHP 5.6
MD5 2007: f0ad7ccf34653a5229ae9ab4c9fdf8b0
MD5 2018: f0ad7ccf34653a5229ae9ab4c9fdf8b0

Testing with PHP 7.0
MD5 2007: f0ad7ccf34653a5229ae9ab4c9fdf8b0
MD5 2018: f0ad7ccf34653a5229ae9ab4c9fdf8b0

Testing with PHP 7.1
MD5 2007: b3bb9a36713bdc2dde76139d23eb0d03
MD5 2018: f0ad7ccf34653a5229ae9ab4c9fdf8b0

Testing with PHP 7.2
MD5 2007: b3bb9a36713bdc2dde76139d23eb0d03
MD5 2018: f0ad7ccf34653a5229ae9ab4c9fdf8b0

Testing with PHP 7.3
MD5 2007: b3bb9a36713bdc2dde76139d23eb0d03
MD5 2018: f0ad7ccf34653a5229ae9ab4c9fdf8b0

Testing with PHP 7.4
MD5 2007: b3bb9a36713bdc2dde76139d23eb0d03
MD5 2018: f0ad7ccf34653a5229ae9ab4c9fdf8b0

Testing with PHP 8.0
Warning: Only the first byte will be assigned to the string offset in /app/Aes2007.php on line 1421 (repeated a lot of times)
MD5 2007: b3bb9a36713bdc2dde76139d23eb0d03
MD5 2018: f0ad7ccf34653a5229ae9ab4c9fdf8b0

For completeness, I'll document the original AES.class.php in the next comment.

My takeaway was that the class behaviour should be consistent if I swap to using the updated class in the new environment, but that the original class (older than the initial commit in this repo) changes behaviour between PHP7.0 and PHP7.1.

Use 128 bit or 256

Hi
Can i define bit size (128,256) before encrypt or decrypt?
Is the current 128 bit?
Thanks

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.