2017 © Pedro Peláez
 

library cryptastic

PHP Encryption / Decryption Using the MCrypt Library.

image

zeyon/cryptastic

PHP Encryption / Decryption Using the MCrypt Library.

  • Tuesday, January 5, 2016
  • by zeyos
  • Repository
  • 2 Watchers
  • 2 Stars
  • 819 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 4 % Grown

The README.md

cryptastic

THIS IS A MODIFIED VERSION OF THE cryptastic CLASS by Andrew Johnson, (*1)

The original code can be found at the following URL, (*2)

http://www.itnewb.com/v/PHP-Encryption-Decryption-Using-the-MCrypt-Library-libmcrypt, (*3)

Example

$pass = 'the password';
$salt = 'the password salt';
$msg  = 'This is the secret message.';

/**********************************************************************************************************************/

// EXAMPLE #1 USING STRING AS MESSAGE

$cryptastic = new cryptastic;

$key = $cryptastic->pbkdf2($pass, $salt, 1000, 32) or
    die("Failed to generate secret key.");

$encrypted = $cryptastic->encrypt($msg, $key) or
    die("Failed to complete encryption.");

$decrypted = $cryptastic->decrypt($encrypted, $key) or
    die("Failed to complete decryption");

echo $decrypted . "<br /><br />\n";

/**********************************************************************************************************************/

// EXAMPLE #2 USING ARRAY AS MESSAGE

$msg        = array('message' => $msg);
$encrypted  = $cryptastic->encrypt($msg, $key);
$decrypted  = $cryptastic->decrypt($encrypted, $key);

echo $decrypted['message'];

The Versions

05/01 2016

dev-master

9999999-dev

PHP Encryption / Decryption Using the MCrypt Library.

  Sources   Download

LGPL

The Requires

  • php >=5.4.0

 

17/10 2014

1.0

1.0.0.0

PHP Encryption / Decryption Using the MCrypt Library.

  Sources   Download

LGPL

The Requires

  • php >=5.4.0