g4/crypto

crypto - encryption php library

2.1.0 2020-11-03 10:31 UTC

This package is auto-updated.

Last update: 2024-10-29 05:04:35 UTC


README

crypto - php library

Install

Via Composer

composer require g4/crypto

Usage

OpenSSL extension

<?php

use G4\Crypto\Crypt;
use G4\Crypto\Adapter\OpenSSL;

$crypto = new Crypt(new OpenSSL());
$crypto->setEncryptionKey('tHi5Is');

$encryptedMessage = $crypto->encode('new message');

$message = $crypto->decode($encryptedMessage);

Mcrypt extension - obsolete

mcrypt-viking-funeral

<?php

use G4\Crypto\Crypt;
use G4\Crypto\Adapter\Mcrypt;

$crypto = new Crypt(new Mcrypt());
$crypto->setEncryptionKey('tHi5Is');

$encryptedMessage = $crypto->encode('new message');

$message = $crypto->decode($encryptedMessage);

Development

Install dependencies

$ composer install

Run tests

$ make integration-tests

License

(The MIT License) see LICENSE file for details...