Home  >  Article  >  Backend Development  >  PHP implements encryption and decryption of Thunder links

PHP implements encryption and decryption of Thunder links

WBOY
WBOYOriginal
2016-08-08 09:30:541333browse

The principle is very simple, it is base64 algorithm and string processing:

<?php
//迅雷链接普通链接转换工具
$url=$_GET[&#39;url&#39;];//获取链接
if($url[0]==&#39;t&#39;&&$url[7]==&#39;:&#39;)//链接为迅雷专用链 解密
{
$str1 = substr($url,10);
$tmp=base64_decode($str1);
$tmp=substr($tmp,2,-2);
echo $tmp;
}
else{//链接为普通链接 加密
$tmp=&#39;AA&#39;.$url.&#39;ZZ&#39;;
$tmp2=base64_encode($tmp);
$tmp3=&#39;thunder://&#39;.$tmp2;
echo $tmp3;}
?>

The above introduces how to implement encryption and decryption of Thunder links in PHP, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn