This article mainly introduces the encryption of PHP source code php-beast, which has certain reference value. Now I share it with everyone. Friends in need can refer to it
Install php-beast
php-beast source code download address:
https://github.com/liexusong/php-beast
Unzip and enter the source code directory
[innpay@localhost soft]$ unzip php-beast-master.zip [innpay@localhost soft]$ cd php-beast-master [innpay@localhost php-beast-master]$ pwd/home/pony/soft/php-beast-master
Compile and install
[innpay@localhost php-beast-master]$ /home/pony/php/bin/phpize Configuring for: PHP Api Version: 20131106Zend Module Api No: 20131226Zend Extension Api No: 220131226[innpay@localhost php-beast-master]$ ./configure --with-php-config=/home/pony/php/bin/php-config [innpay@localhost php-beast-master]$ make [innpay@localhost php-beast-master]$ make install Installing shared extensions: /home/pony/php/lib/php/extensions/no-debug-non-zts-20131226/
After the installation is completed, beast.so is generated in the no-debug-non-zts-20131226 directory.
Edit php.ini and add configuration items: extension=beast.so
Restart apache and check whether beast takes effect through phpinfo
[innpay@localhost apache2]$ ./bin/apachectl restart
Use php-beast
After the installation is completed, enter the tools directory under the source code directory and configure configure.ini
[innpay@localhost tools]$ cat configure.ini ; source path src_path = "/home/pony/php/apache2/htdocs/wechat_nofity"; destination path dst_path = "/home/pony/php/apache2/htdocs/des"; expire time expire = "2019-01-01 12:00:00"; encrypt typeencrypt_type = "DES"
src_path is the path to the encrypted project, dst_path is the path to save the encryption The path of the project, expire is the time when the project can be used (the format of expire is: YYYY-mm-dd HH:ii:ss). encrypt_type is the encryption method, the options are: DES, AES, BASE64. After modifying the configure.ini file, you can use the command php encode_files.php to start the encryption project.
You may encounter the problem that the php command cannot be recognized here:
php: command not found
The solution is to add the php execution path to the PATH of the .bash_profile environment variable
Perform encryption operation:
[innpay@localhost tools]$ php encode_files.php Source code path: /home/pony/php/apache2/htdocs/wechat_nofity Destination code path: /home/pony/php/apache2/htdocs/des Expire time: 2019-01-01 12:00:00------------- start process -------------PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/pony/php/soft/php-beast-master/tools/encode_files.php on line 147Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/pony/php/soft/php-beast-master/tools/encode_files.php on line 147Processed encrypt files [64%] - 100%Failed to encode file `/home/pony/php/apache2/htdocs/wechat_nofity/wechat.class.php' Processed encrypt files [100%] - 100% Finish processed encrypt files, used 0.699295 seconds
Here I am prompted that a file named wechat.class.php failed to be encrypted. I suspect that the file is too long. It doesn’t matter if one fails, I will copy it separately.
The encrypted directory is the des directory. Go in and look at the source code files. They are indeed garbled. But accessing all php pages is normal.
Modify the default encryption key
Because I am using the des encryption method here, a des key will definitely be used. The default key is in des_algo_handler in the php-beast directory. c file:
#include <stdlib.h>#include <string.h>#include "beast_module.h"#include "des_algo_lib.c"static char key[8] = { 0x01, 0x1f, 0x01, 0x1f, 0x01, 0x0e, 0x01, 0x0e, };
can be changed directly, and you can recompile after the change.
The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
Introduction to PHP iterator generator
In PHP, assign the value in the array to an Methods of group variables
The above is the detailed content of PHP source code php-beast encryption. For more information, please follow other related articles on the PHP Chinese website!

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

WebStorm Mac version
Useful JavaScript development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Notepad++7.3.1
Easy-to-use and free code editor
