PHP Classes

Time Lock Crypt: Encrypt data using key generated for a time period

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 64%Total: 225 All time: 8,218 This week: 45Up
Version License PHP version Categories
time-lock-crypt 1.10GNU General Publi...5.4PHP 5, Cryptography
Description 

Author

This class can encrypt data using key generated for a time period.

It takes an expression that defines a given time period and generates a key by creating iteratively hashes of the initial key in a cycle until the specified time as passed.

The class returns the encrypted data using the Fernet class with the generated key.

It can also decrypt previously encrypted data by regenerating the encryption key the same number of iterations that it were used to generate the key when the data was encrypted.

Picture of Lukas Mestan
  Performance   Level  
Name: Lukas Mestan is available for providing paid consulting. Contact Lukas Mestan .
Classes: 8 packages by
Country: Slovak Republic Slovak Republic
Age: 44
All time rank: 8494 in Slovak Republic Slovak Republic
Week rank: 128 Up2 in Slovak Republic Slovak Republic Up
Innovation award
Innovation award
Nominee: 1x

Documentation

Time Lock Encryption Class Build Status Latest Stable Version License

Implementation of timed-release crypto.

This class can encrypt data using key generated for a time period.

It takes an expression that defines a given time period and generates a key by creating iteratively hashes of the initial key in a cycle until the specified time as passed.

The class returns the encrypted data using the Fernet class with the generated key.

It can also decrypt previously encrypted data by regenerating the encryption key the same number of iterations that it were used to generate the key when the data was encrypted.

Requirements

  • PHP 5.3.3 or later
  • hash extension
  • openssl or mcrypt extension

Installation

You can install this library by using [Composer]. You can also view more info about this on [Packagist].

Add this to the require section in your composer.json file.

{
    "require": {
        "arzzen/php-time-lock-encryption": "1.1.*"
    }
}

Usage

<?php
use TimeLockCrypt;

$timeLock = new TimeLockCrypt('keyseed');

$message = 'secret message';
$encrypted = $timeLock->encrypt('+10 second', $message);
$iterations = $timeLock->getIterations();

$decrypted = $timeLock->decrypt($encrypted, $iterations);

var_dump($message == $decrypted);
?>

  Files folder image Files (11)  
File Role Description
Files folder image.github (1 file)
Files folder imagesrc (1 file)
Files folder imagetests (1 file)
Accessible without login Plain text file .gitmodules Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CODE_OF_CONDUCT.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Auxiliary data

  Files folder image Files (11)  /  .github  
File Role Description
  Accessible without login Plain text file FUNDING.yml Data Auxiliary data

  Files folder image Files (11)  /  src  
File Role Description
  Plain text file TimeLockCrypt.php Class Class source

  Files folder image Files (11)  /  tests  
File Role Description
  Accessible without login Plain text file TimeLockCryptTest.php Test Unit test script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:225
This week:0
All time:8,218
This week:45Up
 User Ratings  
 
 All time
Utility:83%StarStarStarStarStar
Consistency:75%StarStarStarStar
Documentation:75%StarStarStarStar
Examples:-
Tests:75%StarStarStarStar
Videos:-
Overall:64%StarStarStarStar
Rank:737