PHP code example of kittinan / crypt-time-php

1. Go to this page and download the library: Download kittinan/crypt-time-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kittinan / crypt-time-php example snippets



$plainText = 'Hello World';

$cryptTime = \KS\CryptTime::getInstance();

$cipherText = $cryptTime->encrypt($plainText);  //Default timeout is 86400 seconds (1 day)

$decryptText = $cryptTime->decrypt($cipherText);



$plainText = 'Hello World';

$cryptTime = \KS\CryptTime::getInstance();

$cipherText = $cryptTime->encrypt($plainText, 600);  //10 minutes = 600 seconds

$decryptText = $cryptTime->decrypt($cipherText);


$cryptTime = \KS\CryptTime::getInstance();
$cryptTime->setIV('MyNewInitialValue');
$cryptTime->setKey('MyNewKeyMyNewKeyMyNewKey');