kittinan / crypt-time-php
CryptTime-PHP is a simple class to encrypt string with timeout. the encryption use AES128/PKCS7.
1.0.0
2014-09-10 17:41 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- satooshi/php-coveralls: dev-master
This package is auto-updated.
Last update: 2024-11-19 21:09:01 UTC
README
CryptTime-PHP is a simple class to encrypt string with timeout. the encryption use AES128/PKCS7.
Requirement
- PHP 5.3+
- php-mcrypt
Composer
This plugin on the Packagist.
https://packagist.org/packages/kittinan/crypt-time-php
Quick Start.
$plainText = 'Hello World'; $cryptTime = \KS\CryptTime::getInstance(); $cipherText = $cryptTime->encrypt($plainText); //Default timeout is 86400 seconds (1 day) $decryptText = $cryptTime->decrypt($cipherText);
if you want to encrypt string with 10 minutes timeout.
$plainText = 'Hello World'; $cryptTime = \KS\CryptTime::getInstance(); $cipherText = $cryptTime->encrypt($plainText, 600); //10 minutes = 600 seconds $decryptText = $cryptTime->decrypt($cipherText);
you can set IV and Key
$cryptTime = \KS\CryptTime::getInstance(); $cryptTime->setIV('MyNewInitialValue'); $cryptTime->setKey('MyNewKeyMyNewKeyMyNewKey');
License
The MIT License (MIT)