2017 © Pedro Peláez
 

library open-encryption

Simple users password encryption class based on OpenSSL

image

browomir/open-encryption

Simple users password encryption class based on OpenSSL

  • Friday, November 13, 2015
  • by Browomir
  • Repository
  • 1 Watchers
  • 0 Stars
  • 57 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Open Encryption

Simple password encryption class based on OpenSSL., (*1)

Prerequisites

  • PHP 5.4 or later

Installation

The preferred way to install this class is through composer., (*2)

Either run, (*3)

php composer.phar require browomir/open-encryption "dev-master"

or add, (*4)

// composer.json
{
    "require": {
        "browomir/open-encryption": "dev-master"
    }
}

to the require section of your composer.json file., (*5)

Usage

This simple example show how you can use this class:, (*6)


require_once 'vendor/autoload.php'; use OpenEncryption\Encryption; $username = 'test@example.com'; $password = 'test123'; $salt = 'somesalt'; $encryption = new Encryption(); // you can pass secret key as constructor parameter // e.g. $encryption = new Encryption('mySecret'); $encrypted = $encryption->encrypt($password, $salt, $username); $decrypted = $encryption->decrypt($encrypted, $salt, $username); echo 'Encrypted: ' . $encrypted; echo '<br>'; echo 'Decrypted: ' . $decrypted;

Additional:, (*7)

  • if you don't want use default cipher method (AES-256-CBC) you can set your own:

$cipher = new Cipher('AES-128-ECB'); $encryption->setCipher($cipher);
  • you can check if chosen cipher is supported and/or is strong:

if ($cipher->isSupported() && $cipher->isCryptoStrong()) { echo 'Your cipher is good!'; } else { echo 'You should chose other cipher!'; }
  • you can get list of all supported cipher by:

$cipher->getSupportedCiphers();

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version Latest Unstable Version Dependency Status Total Downloads License, (*8)

The Versions

13/11 2015

dev-master

9999999-dev

Simple users password encryption class based on OpenSSL

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Avatar Browomir

php password encryption class openssl decryption