Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
zqhong committed Apr 9, 2017
0 parents commit 7e0ec46
Show file tree
Hide file tree
Showing 11 changed files with 517 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor
/.idea
/composer.lock
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Encrypter - A powerful encrypter library based on illuminate/encryption
The encryption algorithms that Encrypter supports:
* AES-128-CFB
* AES-192-CFB
* AES-256-CFB
* RC4
* RC4-MD5

# Simple
```php
<?php

require __DIR__ . "/vendor/autoload.php";


use Zqhong\Encrypter\Encrypter;

$key = 'password';
$cipher = 'RC4-MD5';
$plainText = 'hello world';
$encrypter = new Encrypter($key, $cipher);

$payload = $encrypter->encryptString($plainText);
echo $payload . PHP_EOL;
echo $encrypter->decryptString($payload) . PHP_EOL;

// will output
//eyJpdiI6IiIsInZhbHVlIjoiMDIxR1dXcHg4K21yR2RBPSIsIm1hYyI6ImRhYzFjYWFjODg5ODA1MWFlMWE0OTZmYTNjMTlkYWIxNDExZjAzYzU2ZjlhM2FmMTY1ZWYwYjFkYTJiZjJkNjgifQ==
//hello world
```
27 changes: 27 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "zqhong/encrypter",
"description": "A powerful encrypter library based on illuminate/encryption",
"minimum-stability": "dev",
"license": "MIT",
"authors": [
{
"name": "zqhong",
"email": "zqh0513@gmail.com"
}
],
"require": {
"php": ">=5.4.0",
"ext-mbstring": "*",
"ext-openssl": "*",
"paragonie/random_compat": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "5.7.19"
},
"autoload": {
"psr-4": {
"Zqhong\\Encrypter\\": "src/",
"Zqhong\\Encrypter\\Test\\": "tests/"
}
}
}
24 changes: 24 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="Encrypter Tests">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>
Loading

0 comments on commit 7e0ec46

Please sign in to comment.