Skip to content
forked from Crowdstar/crypt

Handle data encryption/decryption using AES-128, encode with initialization vector.

License

Notifications You must be signed in to change notification settings

diamonjack/crypt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Latest Stable Version Latest Unstable Version License

Summary

The crypt package creates a simple interface for the phpseclib AES-128 library. Its interface allows encryption and decryption of strings with a layer of base64 encoding for easy transmission including the initialization vector.

Installation

composer require crowdstar/crypt:~1.0.0

Sample Usage

1. Encrypt and Encode plain text data for storage or transmission

<?php
use CrowdStar\Crypt\Crypt;

$encodedEncryptedData = (new Crypt("secret_key"))->encrypt("message");

2. Decoding and Decrypting stored or received data

<?php
use CrowdStar\Crypt\Crypt;

$encodedEncryptedData = (new Crypt("secret_key"))->decrypt("encoded_encrypted_data");

3. Encrypting and Decrypting with an alternate length initialization vector

<?php
use CrowdStar\Crypt\Crypt;

$crypt = new Crypt("secret_key");

$alternateIVLength = 8;
$encodedEncryptedData = $crypt->encrypt("message", $alternateIVLength);
$plainText = $crypt->decrypt($encodedEncryptedData, $alternateIVLength);

About

Handle data encryption/decryption using AES-128, encode with initialization vector.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%