moccalotto / crypto
Tiny encryption lib for PHP
0.8.1
2015-12-01 05:39 UTC
Requires
- php: >=5.6.0
- ext-openssl: *
Requires (Dev)
- phpspec/phpspec: ~2.0
This package is not auto-updated.
Last update: 2024-12-21 19:16:09 UTC
README
Encrypt data using aes-128-cbc. Message authentication is done via sha-256 HMAC
Installation
To add this package as a local, per-project dependency to your project, simply add a dependency on
moccalotto/crypto
to your project's composer.json
file like so:
{ "require": { "moccalotto/crypto": "~0.8" } }
Alternatively simply call composer require moccalotto/crypto
Demo
<?php use Moccalotto\Crypto\Crypto; require 'vendor/autoload.php'; $key = 'some secret key'; $plaintext = 'This is the secret plaintext to be encrypted'; $encrypted = Crypto::with($key)->encrypt($plaintext); echo Crypto::with($key)->decrypt($encrypted) . PHP_EOL;