這篇文章主要介紹了關於PHP原始碼php-beast加密,有著一定的參考價值,現在分享給大家,有需要的朋友可以參考一下
安裝php-beast
php-beast原始碼下載位址:
https://github.com/liexusong/php-beast
解壓縮,並進入原始碼目錄
[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
編譯,安裝
[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/
安裝完成後,產生beast.so在no-debug-non-zts-20131226這個目錄下。
編輯php.ini,加入設定項: extension=beast.so
重啟apache,透過phpinfo查看beast是否生效
[innpay@localhost apache2]$ ./bin/apachectl restart
#使用php-beast
安裝完成後, 進入原始碼目錄下的tools目錄,設定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 是要加密專案的路徑,dst_path 是儲存加密後專案的路徑,expire 是設定專案可使用的時間(expire 的格式是:YYYY-mm-dd HH:ii:ss)。 encrypt_type是加密的方式,選擇項目有:DES、AES、BASE64。修改完 configure.ini 檔案後就可以使用指令 php encode_files.php 開始加密專案。
這裡可能遇到執行php指令無法辨識的問題:
php: command not found
解決方法是把php的執行路徑加入.bash_profile環境變數的PATH中
#執行加密操作:
[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
這裡提示我有一個名為wechat.class.php的檔案加密失敗,我懷疑是檔案太長導致的,沒關係有一個不成功我就單獨拷貝過去。
加密後的目錄是des目錄,進去看下原始碼文件,確實都是亂碼。但是訪問所有的php頁面都是正常的。
修改預設加密key
因為我這裡用的是des加密方法,一定會用到一個des密鑰,缺省的密鑰在php-beast目錄下的des_algo_handler. c檔裡:
#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, };
可以直接改,改完重新編譯即可。
以上就是本文的全部內容,希望對大家的學習有所幫助,更多相關內容請關注PHP中文網!
相關推薦:
以上是PHP源碼php-beast加密的詳細內容。更多資訊請關注PHP中文網其他相關文章!

tomakephpapplicationsfaster,關注台詞:1)useopcodeCachingLikeLikeLikeLikeLikePachetoStorePreciledScompiledScriptbyTecode.2)MinimimiedAtabaseSqueriSegrieSqueriSegeriSybysequeryCachingandeffeftExting.3)Leveragephp7 leveragephp7 leveragephp7 leveragephpphp7功能forbettercodeefficy.4)

到ImprovephPapplicationspeed,關注台詞:1)啟用opcodeCachingwithapCutoredUcescriptexecutiontime.2)實現databasequerycachingingusingpdotominiminimizedatabasehits.3)usehttp/2tomultiplexrequlexrequestsandreduceconnection.4 limitesclection.4.4

依赖注入(DI)通过显式传递依赖关系,显著提升了PHP代码的可测试性。1)DI解耦类与具体实现,使测试和维护更灵活。2)三种类型中,构造函数注入明确表达依赖,保持状态一致。3)使用DI容器管理复杂依赖,提升代码质量和开发效率。

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

phpisusedforsenderemailsduetoitsbuilt-inmail()函數andsupportivelibrariesLikePhpMailerAndSwiftMailer.1)usethemail()functionForbasiceMails,butithasimails.2)butithasimail.2)

PHP性能瓶颈可以通过以下步骤解决:1)使用Xdebug或Blackfire进行性能分析,找出问题所在;2)优化数据库查询并使用缓存,如APCu;3)使用array_filter等高效函数优化数组操作;4)配置OPcache进行字节码缓存;5)优化前端,如减少HTTP请求和优化图片;6)持续监控和优化性能。通过这些方法,可以显著提升PHP应用的性能。

依賴性注射(DI)InphpisadesignPatternthatManages和ReducesClassDeptions,增強量強制性,可驗證性和MATIALWINABIOS.ItallowSpasspassingDepentenciesLikEdenciesLikedAbaseConnectionStoclasseconnectionStoclasseSasasasasareTers,interitationAseTestingEaseTestingEaseTestingEaseTestingEasingAndScalability。

cachingimprovesphpermenceByStorcyResultSofComputationsorqucrouctationsorquctationsorquickretrieval,reducingServerLoadAndenHancingResponsetimes.feftectivestrategiesinclude:1)opcodecaching,whereStoresCompiledSinmememorytssinmemorytoskipcompliation; 2)datacaching datacachingsingMemccachingmcachingmcachings


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SublimeText3 Linux新版
SublimeText3 Linux最新版

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

WebStorm Mac版
好用的JavaScript開發工具

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具