Skip to content

This is a very simple PHP encryption library. You can use this library to encrypt or decrypt strings with a 16, 24, 32 characters private key.

dineshuprety/encryptionPHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Encryption

This is a very simple PHP encryption library. You can use this library to encrypt or decrypt string with a 16, 24, 32 characters private key.

Usage

Getting Started

$encryption = new Encryption( string $key );

// Include core encryption library from Src folder
require_once 'Encryptionphp.php';

// Initialize encryption object
$encryption = new Encryption('bZKn8iklVOQr7eC8ONvnCeRFBJwWo1PG');

Encrypt

Encrypts a string to secure it.

$encryption->encrypt( string $text, string $iv);

// iv() funcation for dynamic encrypted data
$iv = $encryption->iv();
// Encrypt a string
$encrypted = $encryption->encrypt('Today is a good day!', $iv);

echo $encrypted;

Decrypt

Decrypts an encrypted chiper.

string $encryption->decrypt( string $chiper. string $iv);

$decrypted = $encryption->decrypt($encrypted, $iv);

echo $decrypted;

Result:

Today is a good day!

Note:

Use this code to encrypt the data into database 

About

This is a very simple PHP encryption library. You can use this library to encrypt or decrypt strings with a 16, 24, 32 characters private key.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published