Download the PHP package chippyash/crypt without Composer

On this page you can find all versions of the php package chippyash/crypt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package crypt

chippyash/Crypt

Quality Assurance

PHP 5.3 PHP 5.4 PHP 5.5 PHP 5.6 PHP 7 Build Status Test Coverage Code Climate

The above badges represent the current development branch. As a rule, I don't push to GitHub unless tests, coverage and usability are acceptable. This may not be true for short periods of time; on holiday, need code for some other downstream project etc. If you need stable code, use a tagged version. Read 'Further Documentation' and 'Installation'.

The Travis tests cover multiple versions of PHP. However, they do not allow usage of system commands, hence the getMac() method of Crypt.php doesn't work on the Travis servers. Check it out for yourself.

What?

Provides a simple encryption capability

Why?

Encryption is not generally straightforward. This library tries to ease the pain. At the present time, a single verified encryption method is provided.

As the majority of web encryption requires that you are able to store the value in cookies, database tables etc, by default the encrypted value is encoded using Base 64. You can switch that off if required.

How

The encryption methods supported by this library all require an encryption key. You can generate this (on a *nix based system at least,) by running uuidgen

You need to supply an encryption method to the Crypt class. At present one is provided for you, Rijndael256, but you can implement others by implementing the MethodInterface.

The supplied Rijndael256 method is capable of encrypting any PHP serializable object.

use Chippyash\Crypt\Crypt;
use Chippyash\Crypt\Crypt\Method\Rijndael256;
use chippyash\Type\String\StringType;
use chippyash\Type\BoolType;

$crypt = new Crypt(new StringType('my seed value'), new Rijndael256());

$encrypted = $crypt->encrypt($someValue);
$decrypted = $crypt->decrypt($encrypted);

By default the encrypted value is encoded using Base64. You can get the raw value thus:

$encrypted = $crypt->encrypt($someValue, new BoolType(false));

If you are not using Base64 encoding to encrypt, you need to switch it off in the decrypt as well:

$decrypted = $crypt->decrypt($encrypted, new BoolType(false));

By default, on *nix based machines, the seed that you supply on construction is mixed with the mac address of the machine that the code is running on, if it can be found. This ensures that only that machine can encrypt and decrypt a given value. If you do not want this, say for instance that you are running on load balanced machines and storing in a central database, you can switch it off:

$crypt = new Crypt(new StringType('my seed value'), new Rijndael256());
$crypt->setUseMacAddress(new BoolType(false));

Development only

This library is no longer maintained and serves only as an example of encryption and as a holder for the work of others before me

If you have a wish to pick this up and take it further, please contact me.

only on master branch at present

As an example of how you can wrap other libraries into this, I've supplied the Blowfish method, which requires the Zend Crypt library.

use Chippyash\Crypt\Crypt\Method\Blowfish;

$crypt = new Crypt(new StringType('my seed value'), new Blowfish());

If you want to do very serious cryptography the Zend Crypt library is a good starting point. If you just want sound and simple, use this library. You will need to use the now default composer install to bring in dev dependencies to use the Zend stuff. If you like it then add "zendframework/zend-crypt": "~2.5.0" to your project composer 'requires' statement;

Further documentation

Test Contract in the docs directory. For Symfony users, you'll also find an example DIC definition in the docs directory

Check out ZF4 Packages for more packages

UML

class diagram

Changing the library

  1. fork it
  2. write the test
  3. amend it
  4. do a pull request

Found a bug you can't figure out?

  1. fork it
  2. write the test
  3. do a pull request

NB. Make sure you rebase to HEAD before your pull request

Or - raise an issue ticket.

Where?

The library is hosted at Github. It is available at Packagist.org

Installation

Install Composer

For production

    "chippyash/crypt": "~1.0.0"

Or to use the latest, possibly unstable version:

    "chippyash/crypt": "dev-master"

To use the Zend cryptography lib under my lib add the "zendframework/zend-crypt": "~2.5.0" line to your composer require section.

For development

Clone this repo, and then run Composer in local repo root to pull in dependencies

    git clone [email protected]:chippyash/Crypt.git Crypt
    cd Crypt
    composer install

To run the tests:

    cd Crypt
    vendor/bin/phpunit -c test/phpunit.xml test/

License

This software library is released under the GNU GPL V3 or later license

This software library is Copyright (c) 2015, Ashley Kitson, UK

This software library contains code items that are derived from other works:

None of the contained code items breaks the overriding license, or vice versa, as far as I can tell. So as long as you stick to GPL V3+ then you are safe. If at all unsure, please seek appropriate advice.

If the original copyright owners of the derived code items object to this inclusion, please contact the author.

A commercial license is available for this software library, please contact the author. It is normally free to deserving causes, but gets you around the limitation of the GPL license, which does not allow unrestricted inclusion of this code in commercial works.

Thanks

I didn't do this by myself. I'm deeply indebted to those that trod the path before me.

The Rijndael256 cryptography method is based on code created by Andrew Johnson. I can find no current location or link for Andrew, so if you know him (he created Cryptastic,) please do let me know.

History

V1.0.0 Initial Release

V1.1.0 Update dependencies

V1.1.1 Add link to packages

Abandoned.


All versions of crypt with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
ext-mcrypt Version *
chippyash/strong-type Version ~3.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package chippyash/crypt contains the following files

Loading the files please wait ...