PHP
  Home arrow PHP arrow PHP Encryption and Decryption Methods
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

PHP Encryption and Decryption Methods
By: Codex-M
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2009-11-03


    Table of Contents:
  • PHP Encryption and Decryption Methods
  • Base 64 Encoding and Compression/Decompression Techniques
  • PHP Eval Function in Encoding Methods
  • Case Example: Encoding a Working PHP Script

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    PHP Encryption and Decryption Methods
    ( Page 1 of 4 )

    PHP encryption is a method of obfuscating scripts in such a way that it offers additional protection and prevents unauthorized editing of the scripts. This article discusses both encryption and decryption.

    You might have seen encrypted PHP scripts which may look like the one below:

    <?php eval(gzinflate(base64_decode('FZfHDoTYEUV/ZXYzIxbkJFseAU1qcg4bi9TknPl64z0SUK/
    evef8859///NHcSTdX+VTD78u2Yq/0mQtCOy/
    eZGNefHXn0L8kz5jKAueDcZhVNSnh9+OYd6flsK+PCKjqtEnIJoRtF3TO+
    GH4UyCIED/st8VD9APjg8Nj+m1ysH0OIjnWTbNnIa+
    P4Xyh7gC3XsCCgIOdqVtDlCOaQsau4uAKCI+
    aEQxXEg96A4GpOsr85SHX9FcHSL6R+h57gJZzBE872FRE6v7vNdZpzaBU+
    GYWOpCnDOMU5n16lgPBE3Qh5ejKZqYA7YSRf3y'))); ?>

    If you're interested, you can check out the actual encryption tool for this. In the above example, the complete sets of PHP codes are not visible and are replaced by an obfuscated method of encoding. This article attempts to explain the methods of encrypting and decrypting PHP scripts. One of the popular ways to encrypt scripts is to encode the scripts into another data format such as base 64 encoding.

    The decryption process is the exact opposite of the encryption process. The scope of this article covers reversible encryption/decryption processes. Although in PHP it is possible to provide one-way encryption, with techniques such as MD5 encoding, this type of encoding cannot be reversed or decoded. It is ideal for storing passwords in the database, which adds an extra layer of security over storing them in text format. For some differences in the methods, see the screen shot below.

    For example, WordPress uses MD5 encoding when storing passwords in the MySQL database. So even if the database has been compromised, the hacker cannot retrieve the actual password (in text format) being used for the admin login.



     
     
    >>> More PHP Articles          >>> More By Codex-M
     

       

    PHP ARTICLES

    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek