The paragraph on code protection is somewhat misleading. While it is correct that the exact source code can not be recreated this does not offer anything in terms of code protection and lures people into a false sense of security. The same was thought of machine code until backward-engineering became so advanced that programs were "rewritten" to change the behaviour of functions or enable/disable them and the same is true for classes.
Overconfidence and "impossibilities" are what people looking for a challenge thrive on. Encryption and obfuscation are ways to make it more difficult but not impossible. As a general rule if it can be executed it can be modified so if you don't want it to be put under the microscope then don't release it in the first place.
導入
この拡張モジュールは、 実験的 なものです。この拡張モジュールの動作・ 関数名・その他ドキュメントに書かれている事項は、予告なく、将来的な PHP のリリースにおいて変更される可能性があります。 このモジュールは自己責任で使用してください。
Bcompiler は、以下のような目的で作成されました。
- プロプライエタリな PHP アプリケーションのスクリプト全体をエンコードするため
- プロプライエタリな PHP アプリケーションの一部のクラスや関数をエンコードするため
- クライアントのデスクトップで動作する php-gtk アプリケーションを、 php.exe を用いずに実行させるため
- PHP から C へのコンバータの実現可能性を調べるため
2 番目の目的を実現するには bcompiler_write_header()、 bcompiler_write_class()、 bcompiler_write_footer()、 bcompiler_read() および bcompiler_load() 関数を使用します。 バイトコードのファイルが、圧縮されていないか あるいはプレーンな形式で書き出されます。 bcompiler_load() は、bzip で圧縮された バイトコードファイルを読み込みます。これは元のファイルに比べて 1/3 程度の大きさになります。
EXE 形式のファイルを作成するには、修正された sapi ファイルか 共有ライブラリとしてコンパイルされた PHP とともに bcompiler を使用する必要があります。この場合、bcompiler は 圧縮されたバイトコードを exe ファイルの後ろから読み込みます。
圧縮しないバイトコードのみで使用した場合、bcompiler によって 処理速度を約 30% 向上させることが可能です。しかし、圧縮しない バイトコードは元のソースコードに比べて 5 倍程度の大きさに なることに気をつけてください。バイトコードを圧縮することで 容量を節約することが可能ですが、圧縮ファイルを展開するのには ソースコードをパースするよりはるかに長い時間がかかります。 bcompiler はバイトコードに対する最適化を一切行いません。 これは将来のバージョンで対応する予定です…。
コードの保護という点に関しては、もとのソースコードやコメントを 復元することは不可能であると考えて間違いありません。bcompiler のバイトコードをもとにしてコードを復元し、クラスに手を加える といったことは無意味です。しかし、bcompiler で作成した バイトコードファイルからデータを取り出すことは可能です。 個人的なパスワードなどの情報をバイトコードの中に含めないでください。
導入
16-Apr-2008 03:55
