PHP Classes

OTP_TS: Encrypt and decrypt data with one time pad cipher

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 844 All time: 4,113 This week: 177Up
Version License PHP version Categories
otp_ts 1GNU Lesser Genera...4.0Cryptography


This class can be used to encrypt and decrypt data with one time pad cipher algorithm implemented in pure PHP.

The class has a single function that takes a password and a string of the data to encrypt.

The password is used to create a cypher that encrypts the data using an XOR operation.

The same function to encrypt can be used to decrypt the encrypted data using the same password.

Innovation Award
PHP Programming Innovation award nominee
June 2007
Number 8

Prize: One downloadable copy of PhpED Professional
The quality of encryption algorithms depends on how hard they are to break using brute force methods.

Most strong encryption methods also take a lot of CPU resources to encrypt and decrypt data.

One time pad algorithms are much simpler and take less resources when used to encrypt and decrypt data.

This class implements a one-time pad algorithm in pure PHP code. It generates several hashes of the encryption password to compute a random cypher that is used to encrypt and decrypt data.

The actual encryption and decryption is very light because it consists of a simple XOR operation over the data to encrypt or decrypt. The encryption and encryption procedure is the same, making the class very small.

Manuel Lemos
Picture of Jacek Wloka
Name: Jacek Wloka <contact>
Classes: 6 packages by
Country: Poland Poland
Age: 37
All time rank: 3708 in Poland Poland
Week rank: 346 Up9 in Poland Poland Down
Innovation award
Innovation award
Nominee: 1x

  • Image1.gif
  Files folder image Files  
File Role Description
Plain text file example_file.php Example Example 1 of file
Plain text file example_form.php Example Example 3
Plain text file example_txt.php Example Text example 1
Plain text file class.OTP_TS.php Class class OTP_TS
Image file linux.bmp Icon img 1

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:4,113
This week:177Up