Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Encryption

Encryption library bundled with Zest.

Configuration

The default encryption adapter in config file Config/App.php is set openssl

::: warning You should change your encryption key :::

Encrypt

You can encrypt string by calling to encrypt method

<?php 
use Zest\Encryption\Encryption;

$encryption = new Encryption('your-key'); // key is optional

//Encrypt the message
$encrypt = $encryption->encrypt("This is a text");

echo $encrypt;

Decrypt

You can decrypt token by calling decrypt method

<?php 
$encryption = new Encryption('your-key');

//Decrypt the message
$decrypt = $encryption->decrypt($encrypt);	
echo $decrypt;

Adapter

This Package support two encryption adapter

  • OpenSSL
  • Sodium

change Adapter

You can pass supported adapter to class like

Use of sodium

<?php 
$encryption = new Encryption('your-key','sodium');

::: danger Sodium php extension is required. :::

Use of openSSL

::: tip The adapter can also be changed from Config/App.php file. :::

<?php 
$encryption = new Encryption('your-key','openssl');

::: danger openSSL php extension is required. :::