Home > Backend Development > PHP Tutorial > 一PHP可逆加解密算法

一PHP可逆加解密算法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-20 12:39:15
Original
792 people have browsed it

求助一PHP可逆加解密算法
例如算法规则:
a=b
b=c
c=d
d=e
……
x=y
y=z
z=a
0=1
1=2
2=3
……
8=9
9=0
字母与数字都按一定的大小字母或数字替换
例子:
加密前内容:123abc
加密成:234def
就这样子,同时能按替换的规则来解密还原
请大家帮我这个效果,谢谢


回复讨论(解决方案)

$dict = array(  'a' => 'b',  'b' => 'c',  'c' => 'd',  'd' => 'e',  '0' => '1',  '1' => '2',  '2' => '3',  '3' => '4',);echo $t = strtr('123abc',$dict), PHP_EOL;echo strtr($t, array_flip($dict));
Copy after login
234bcd123abc
Copy after login

非常感谢,原来是这两个函数

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template