crazyfd/phpaes

PHP aes 加解密

Installs: 12

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:php-aes

dev-master 2016-08-01 02:17 UTC

This package is not auto-updated.

Last update: 2024-12-21 21:14:07 UTC


README

javaAes2php

目前和和其他公司项目接口对接,对方项目是java开发,丢过来的接口文档上面有个字段说明是aes加密了,其他的信息没了, 经过几次沟通,叫对方给了一个明文和密文的东西给过来,然后才知道对方是用什么模式生成的。

php > 5.5

How to install? To use this extension, you may insert the following code:

Get it via composer by adding the package to your composer.json:

{
  "require": {
    "crazyfd/phpaes": "dev-master"
  }
}

执行命令

php composer.phar update

使用

<?php 
$key = '1111111122222222';
$content = 'php';
$content2 = 'SqdeMqCpaO8qfXP+Z2ICoQ==';

$aes = new \carazyfd\phpaes\Aes($key);
$content =$aes->strPad($content, 16);
echo $aes->encode($content);
echo "<br>";
echo $aes->decode($content2);