Share 2 types of PHP source code encryption, this encryption method supports any PHP version.
Note that the encrypted PHP code does not need to be decrypted by a third-party tool, as usual, to run directly.
Copy CodeThe code is as follows:
function Encode_file_contents ($filename) {
$type =strtolower (substr (STRRCHR ($filename, '. '), 1));
if (' php ' = = $type && is_file ($filename) && is_writable ($filename)) {//If it is a PHP file and can be written with compression encoding
$contents = file_get_contents ($filename); Determine if the file has been encoded
$contents = Php_strip_whitespace ($filename);
$s = ' ';
Echo $s;
Generate an encrypted PHP file
$FPP 1 = fopen (' Temp_ '. $filename, ' W ');
Fwrite ($FPP 1, $s) or die (' Write file error ');
?>
In fact, there are many ways to encrypt the source code, for example, free micro-shield PHP encryption, as well as www.phpjm.net engage in online encryption, just PHPJM more complex points.
In addition, sharing a PHP class, it can be the content of the text of binary encryption and decryption, the code is as follows:
Copy CodeThe code is as follows:
Class Text_auth
{
var $n _iter;
function Text_auth ()
{
$this->setiter (32);
}
function Setiter ($n _iter)
{
$this->n_iter = $n _iter;
}
function Getiter ()
{
return $this->n_iter;
}
function Encrypt ($data, $key)
{
$n = $this->_resize ($data, 4);
$filename = S_root. './789.php '; Encrypted text is binary, normal text editor does not view normally
File_put_contents ($filename, $STR);
Decryption process
View Sourceprint
? _file $text = S_root. './789.php ';
$str = @file_get_contents ($text _file);
Require_once S_root. "./text_auth.php";
$text _auth = new Text_auth (64);
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.