GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - lihancong/tonyenc: 高性能、跨平台的 PHP7 代码加密扩展 (A high performance and cross-platform encrypt extension for PHP source code)

BranchesTags
Open more actions menu

Latest commit

 

History

45 Commits
45 Commits

Folders and files

NameName
Last commit message
Last commit date
windows-dlls
windows-dlls
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
config.m4
config.m4
 
 
core.h
core.h
 
 
php_tonyenc.h
php_tonyenc.h
 
 
tonyenc.c
tonyenc.c
 
 
tonyenc.php
tonyenc.php
 
 

Repository files navigation

介绍

  • 一个简洁、高性能、跨平台的 PHP7 代码加密扩展,当前版本为 0.2.2
  • 对 PHP7.3 的支持在 dev 分支,还没测试,感谢 @toxmc

特点

  • 简单快速,经实测,几乎不影响性能
  • 兼容 OPcache、Xdebug 等其他扩展
  • 兼容 Linux、macOS、Windows 等系统
  • 兼容 Apache、Nginx + PHP-fpm、命令行等运行模式
  • 加密算法较简单,这是出于速度考虑,但仍不易解密
  • 若项目的 php 文件很多,建议只加密部分重要代码文件
  • 要求 PHP >= 7.0,对 PHP7.3 的支持在 dev 分支,还没测试

加密前记得备份!!!

安装

编译前请在 core.h 中做如下修改:

/* 这里定制你的加密特征头,不限长度,十六进制哦 */
const u_char tonyenc_header[] = {
        0x66, 0x88, 0xff, 0x4f,
        0x68, 0x86, 0x00, 0x56,
        0x11, 0x16, 0x16, 0x18,
};

/* 这里指定密钥,长一些更安全 */
const u_char tonyenc_key[] = {
        0x9f, 0x49, 0x52, 0x00,
        0x58, 0x9f, 0xff, 0x21,
        0x3e, 0xfe, 0xea, 0xfa,
        0xa6, 0x33, 0xf3, 0xc6,
};

在 Linux、macOS 上编译

git clone https://github.com/lihancong/tonyenc.git
cd tonyenc
phpize
./configure
make

将编译好的文件 modules/tonyenc.so 加入到配置项 extension=tonyenc.so,重启 PHP 服务

在 Windows 上编译

已编译了以下模块,可供测试(这里的密钥与源代码中的不同,需要安装有 VC14 运行库):

# php7.0 64位 线程安全版
php_tonyenc_php70_ts_VC14_x64.dll
# php7.0 64位 线程非安全版
php_tonyenc_php70_nts_VC14_x64.dll

手动编译方法见 issues

加密

代码中的 tonyenc.php 是加密工具:

php tonyenc.php example.php dir/

这样即可加密 example.php 和 dir 目录下的所有 php 文件,PHP 在运行它们时会自动解密,够简单吧!

版权

允许转载、修改、商用

这是我开发的第一个扩展,如有不足欢迎指正 :)

About

高性能、跨平台的 PHP7 代码加密扩展 (A high performance and cross-platform encrypt extension for PHP source code)

Topics

encryptextensionphp

Resources

Readme
Activity

Stars

727 stars

Watchers

33 watching

Forks

203 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.