PHP ソースコード php-beast 暗号化

不言
リリース: 2023-04-02 14:52:02
オリジナル
5059 人が閲覧しました

この記事では主に、ある参考値を持つ 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/
ログイン後にコピー

インストールが完了すると、no-debug-non-zts-20131226 ディレクトリに Beast.so が生成されます。

php.ini を編集し、設定項目を追加します: extension=beast.so

Apache を再起動し、phpinfo を通じて Beast が有効かどうかを確認します

[innpay@localhost apache2]$ ./bin/apachectl restart
ログイン後にコピー

PHP ソースコード php-beast 暗号化

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 ページにアクセスするのは正常です。

デフォルトの暗号化キーを変更する

ここでは 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 中国語 Web サイトをご覧ください。

関連する推奨事項:

PHP イテレータ ジェネレーターの概要

PHP では、配列内の値をメソッドに代入します。グループ変数の数

#

以上がPHP ソースコード php-beast 暗号化の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!