Skip to content
/ pincryp Public

🧛 A layer of encryption a little too judicious

License

Notifications You must be signed in to change notification settings

attla/pincryp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pincryp

License Latest Stable Version Total Downloads

🧛 A layer of encryption a little too judicious.

Installation

composer require attla/pincryp

Usage

use Attla\Pincryp\Config;
use Attla\Pincryp\Factory as Pincryp;

// create config instance
$config = new Config();
$config->key = 'hic sunt dracones';
// or
$config = new Config(['key' => 'hic sunt dracones']);

// creating Pincryp instance
$pincryp = new Pincryp($config);

// encoding
$encoded = $pincryp->encode('this is something to encode..');
echo 'encoded: ' . $encoded.PHP_EOL;

$decoded = $pincryp->decode($encoded);
echo 'decoded: ' . $decoded.PHP_EOL;

The Pincryp can encrypt all primitive types: array, stdClass, bool, string, integer, float and null.

See an example of array encryption:

// encoding
$encoded = $pincryp->encode([
    'name' => 'John Doe',
    'email' => 'john@example.com'
]);
echo 'encoded: ' . $encoded.PHP_EOL;

// to return a stdClass pass the second param as TRUE
$decoded = $pincryp->decode($encoded, false);
echo 'decoded: ' . $decoded.PHP_EOL;

Config params

Parameter Type Description
key String Encryption secret key
entropy Integer Entropy length to generate unique results, set zero for always the same results
seed String, Integer, Null Alphabet base seed to create a unique dictionary

License

This package is licensed under the MIT license © Zunq.

Releases

No releases published

Languages