PHP Classes

TxtCrypt: Encrypt a file and hide it in a regular text file

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 1,559 All time: 2,528 This week: 131Up
Version License Categories
txtcrypt 1.0.0GNU General Publi...Cryptography, Text processing


This class can encrypt a file and insert the encrypted data into a regular text file in such way that it does not change the way the text file appears.

The encrypt algorithm is simple but it can be replaced by another more robust algorithm.

To hide the encrypted data within a text file without changing how it appears, the data is compressed, encrypted, and converted to bit stream. The bit stream is then converted to tab (0x09) and space (0x20) characters , replacing the '1's and '0's of the bit stream. The resulting tab and space character strings is then added to the end of the carrier file.

The original carrier file size is also recorded as a converted bit stream in the end of the output file. This additional piece of information is used to extract the hidden file by the class decrypt function.

Innovation Award
PHP Programming Innovation award nominee
April 2005
Number 5
Steganography is the process of hiding information inside data.

One of the purposes of steganography is to pass an implicit message without letting the messenger be aware that it is carrying it and so prevent that he realizes that it is there and what it means.

This class implements an steganography solution based on a smart technique for hiding data within a text message by using white space characters like tabs and spaces.

Since white space does not show anything when it is printed, this technique can be very successful on the purpose of hiding arbitrary binary messages within unsuspected texts.

Manuel Lemos
Picture of Chao-Chyuan Shih
Name: Chao-Chyuan Shih <contact>
Classes: 2 packages by
Country: United States United States
Age: 72
All time rank: 73496 in United States United States
Week rank: 341 Up44 in United States United States Up
Innovation award
Innovation award
Nominee: 2x

  Files folder image Files  
File Role Description
Plain text file TxtCrypt_Class.php Class TxtClass
Accessible without login Plain text file TxtCrypt_CommandLine_Example.php Example Command Line Example
Accessible without login Plain text file TxtCrypt_Webpage_Example.php Example Webpage Example

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:2,528
This week:131Up