php-beast加密PHP代码

1.安装

$ wget https://github.com/liexusong/php-beast/archive/master.zip
$ unzip master.zip 
$ cd php-beast-master 
$ /www/server/php/56/bin/phpize 
$ ./configure --with-php-config=/www/server/php/56/bin/php-config
$ sudo make && make install
编译好之后修改php.ini配置文件, 加入配置项: extension=beast.so, 重启php-fpm 

.2、加密配置项

配置文件位于tools目录下configure.ini文件

src_path = ""  //加密项目的路径
dst_path = ""  //保存加密后的项目的路径
expire = "2021-12-15 24:00:00" //过期时间
encrypt_type = "DES" //加密方式 DES/AES/BASE64

3、执行加密操作

/www/server/php/56/bin/php encode_files.php

4.等待加密成功

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是使用JavaScript实现Beast64编码解码的示例代码: ```javascript // Base64编码表 const base64Table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; function beast64Encode(input) { let output = ''; let chr1, chr2, chr3, enc1, enc2, enc3, enc4; let i = 0; while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + base64Table.charAt(enc1) + base64Table.charAt(enc2) + base64Table.charAt(enc3) + base64Table.charAt(enc4); } return output; } function beast64Decode(input) { let output = ''; let chr1, chr2, chr3; let enc1, enc2, enc3, enc4; let i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ''); while (i < input.length) { enc1 = base64Table.indexOf(input.charAt(i++)); enc2 = base64Table.indexOf(input.charAt(i++)); enc3 = base64Table.indexOf(input.charAt(i++)); enc4 = base64Table.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); } } return output; } ``` 使用示例: ```javascript const input = 'hello world'; const encoded = beast64Encode(input); const decoded = beast64Decode(encoded); console.log(encoded); // 输出 SGVsbG8gd29ybGQ= console.log(decoded); // 输出 hello world ``` 以上代码实现了Beast64的编码和解码功能,可以将任意字符串转换为Beast64编码后的字符串,并将Beast64编码的字符串解码为原始字符串。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值