Skip to content

Commit

Permalink
Merge pull request #3 from martinusso/opencrypt
Browse files Browse the repository at this point in the history
rename project to opencrypt
  • Loading branch information
martinusso authored Oct 24, 2017
2 parents 2340f14 + 34de71d commit c1e1ba8
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 43 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# simplecrypt
# opencrypt

[![Build Status](https://travis-ci.org/martinusso/simplecrypt.svg?branch=master)](https://travis-ci.org/martinusso/simplecrypt)
[![Build Status](https://scrutinizer-ci.com/g/martinusso/simplecrypt/badges/build.png?b=master)](https://scrutinizer-ci.com/g/martinusso/simplecrypt/build-status/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/martinusso/simplecrypt/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/martinusso/simplecrypt/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/martinusso/simplecrypt/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/martinusso/simplecrypt/?branch=master)
[![Build Status](https://travis-ci.org/martinusso/opencrypt.svg?branch=master)](https://travis-ci.org/martinusso/opencrypt)
[![Build Status](https://scrutinizer-ci.com/g/martinusso/opencrypt/badges/build.png?b=master)](https://scrutinizer-ci.com/g/martinusso/opencrypt/build-status/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/martinusso/opencrypt/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/martinusso/opencrypt/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/martinusso/opencrypt/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/martinusso/opencrypt/?branch=master)

Encrypts and decrypts data using PHP with OpenSSL

## Installation

`composer require martinusso/simplecrypt`
`composer require martinusso/opencrypt`

## Usage

```
$password = "simplecrypt";
$password = "OpenCrypt";
$secretKey = 'SECRET_KEY';
$secretIV = 'SECRET_IV';
$simpleCrypt = new SimpleCrypt($secretKey, $secretIV);
$openCrypt = new OpenCrypt($secretKey, $secretIV);
$encryptedPassword = $simpleCrypt->encrypt($password);
// $encryptedPassword = 'VGU4aUJiM1dZWmhHaDNGUUlnd05vUT09'
$decryptedPassword = $simpleCrypt->decrypt($encryptedPassword);
// $decryptedPassword = 'simplecrypt'
$encryptedPassword = $openCrypt->encrypt($password);
// $encryptedPassword = 'RTZPSEUybDZLZy9lSzYwaHk1Y0gxZz09'
$decryptedPassword = $openCrypt->decrypt($encryptedPassword);
// $decryptedPassword = 'OpenCrypt'
```

## License

This software is open source, licensed under the The MIT License (MIT). See [LICENSE](https://github.com/martinusso/simplecrypt/blob/master/LICENSE) for details.
This software is open source, licensed under the The MIT License (MIT). See [LICENSE](https://github.com/martinusso/opencrypt/blob/master/LICENSE) for details.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "martinusso/simplecrypt",
"name": "martinusso/opencrypt",
"type": "library",
"description": "Encrypts and decrypts data using PHP with OpenSSL",
"keywords": [
Expand All @@ -8,7 +8,7 @@
"decrypt",
"OpenSSL"
],
"homepage": "https://github.com/martinusso/simplecrypt",
"homepage": "https://github.com/martinusso/opencrypt",
"license": [
"MIT"
],
Expand All @@ -28,12 +28,12 @@
},
"autoload": {
"psr-4": {
"SimpleCrypt\\": "src/"
"OpenCrypt\\": "src/OpenCrypt/"
}
},
"autoload-dev": {
"psr-4": {
"SimpleCrypt\\Tests\\": "tests/"
"OpenCrypt\\Tests\\": "tests/"
}
},
"minimum-stability": "stable",
Expand Down
3 changes: 1 addition & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/bootstrap.php" colors="true" verbose="true">
<testsuites>
<testsuite name="SimpleCrypt Test Suite">
<testsuite name="OpenCrypt Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>
Expand Down
4 changes: 2 additions & 2 deletions src/SimpleCrypt.php → src/OpenCrypt/OpenCrypt.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace SimpleCrypt;
namespace OpenCrypt;

class SimpleCrypt
class OpenCrypt
{
private $encryptMethod = "AES-256-CBC";
private $secretKey;
Expand Down
21 changes: 21 additions & 0 deletions tests/OpenCryptTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace OpenCrypt\Tests;

use OpenCrypt\OpenCrypt;

final class OpenCryptTest extends \PHPUnit\Framework\TestCase
{
public function testCrypt()
{
$password = "OpenCrypt";

$openCrypt = new OpenCrypt('1', '2');

$encryptedPassword = $openCrypt->encrypt($password);
$this->assertEquals('RTZPSEUybDZLZy9lSzYwaHk1Y0gxZz09', $encryptedPassword);

$decryptedPassword = $openCrypt->decrypt($encryptedPassword);
$this->assertEquals($password, $decryptedPassword);
}
}
21 changes: 0 additions & 21 deletions tests/SimpleCryptTest.php

This file was deleted.

0 comments on commit c1e1ba8

Please sign in to comment.