Are there any great gods ?? Find reversible dynamic encryption function (2-WAYPHP version) http://www.xxx.tld /? User = K5idDC
Http://www.xxx.tld /? User = 2RK4dm
Http://www.xxx.tld /? User = 3 weolap
Http://www.xxx.tld /? User = Login mf3 ......
For example, the values of the preceding user parameters all point to the data page of the same user name (ABCD). there is a dynamic reversible function that enables a user name to correspond to thousands of encrypted characters. if there is no reversible function, if you need a database to store the corresponding relationship, it is very troublesome!
The requirements are as follows:
1. a refresh can be changed once and reversible;
2. the length of the encrypted content is about the same as that of the encrypted content;
Do you know such a function? Do you have any idea? Please share it. thank you!
The encrypted password of the DZ function searched on the Internet is too long to be used as a URL.
Reply to discussion (solution)
For ($ I = 0; $ I <10; $ I ++) {echo $ m = encode ('ABCD'); echo ':'. decode ($ m ). PHP_EOL;} function encode ($ s) {$ d = array_map ('chr', range (0x21, 0x7e); $ len = count ($ d ); $ t = rand (0, $ len); $ r = $ d [$ t]; for ($ I = 0; $ I
Iijkl: ABCD
3 STUV: ABCD
) IJKL: ABCD
) IJKL: ABCD
Ddefg: ABCD
Zz {|}: ABCD
@ 'ABC: ABCD
O1234: ABCD
J,-./: ABCD
3 STUV: ABCD
For ($ I = 0; $ I <10; $ I ++) {echo $ m = encode ('ABCD'); echo ':'. decode ($ m ). PHP_EOL;} function encode ($ s) {$ d = array_map ('chr', range (0x21, 0x7e); $ len = count ($ d ); $ t = rand (0, $ len); $ r = $ d [$ t]; for ($ I = 0; $ I
Iijkl: ABCD
3 STUV: ABCD
) IJKL: ABCD
) IJKL: ABCD
Ddefg: ABCD
Zz {|}: ABCD
@ 'ABC: ABCD
O1234: ABCD
J,-./: ABCD
3 STUV: ABCD
Great Gods are strong here! Thank you! Is there a way to remove special symbols? Is it not good to use the URL?
Just put it in the project. If the character has/, rewrite will cause an error.
There is a high probability that a number will appear. Is there any way to prevent it from having special characters?
The array $ d in the function is a list of all allowed characters. in my example, all printable ASCII characters (excluding spaces)
You can adjust the scale according to your needs
Adjust the code
/* // Generate a random dictionary $ d = str_split ('2017 _ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy'); shuffle ($ d); echo join ('', $ d ). PHP_EOL; */define ('dict ', 'hpke6f0vwb8cc3ha _ done'); for ($ I = 0; $ I <10; $ I ++) {echo $ m = encode ('ABC'); echo ':'. decode ($ m ). PHP_EOL;} function encode ($ s) {$ d = str_split (DICT); $ len = count ($ d); $ t = rand (0, $ len ); $ r = $ d [$ t]; for ($ I = 0; $ I
OTfuH: ABCD
OUkI5: ABCD
CiN5V: ABCD
6 Kvan: ABCD
4gzj3: ABCD
Un6vP: ABCD
So1Vw: ABCD
MYyhZ: ABCD
Z_YDr: ABCD
FBr_h: ABCD
Adjust the code
/* // Generate a random dictionary $ d = str_split ('2017 _ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy'); shuffle ($ d); echo join ('', $ d ). PHP_EOL; */define ('dict ', 'hpke6f0vwb8cc3ha _ done'); for ($ I = 0; $ I <10; $ I ++) {echo $ m = encode ('ABC'); echo ':'. decode ($ m ). PHP_EOL;} function encode ($ s) {$ d = str_split (DICT); $ len = count ($ d); $ t = rand (0, $ len ); $ r = $ d [$ t]; for ($ I = 0; $ I
OTfuH: ABCD
OUkI5: ABCD
CiN5V: ABCD
6 Kvan: ABCD
4gzj3: ABCD
Un6vP: ABCD
So1Vw: ABCD
MYyhZ: ABCD
Z_YDr: ABCD
FBr_h: ABCD
Thank you! I just want this. what is the corresponding decode? I have a very good algorithm!
Oh, I missed it.
Function decode ($ s) {$ d = str_split (DICT); $ len = count ($ d); $ r = ''; $ t = array_search ($ s {0}, $ d); for ($ I = 1; $ I
Oh, I missed it.
Function decode ($ s) {$ d = str_split (DICT); $ len = count ($ d); $ r = ''; $ t = array_search ($ s {0}, $ d); for ($ I = 1; $ I
9 SpQl: ABCD
YDhBY: ABCD
LctwQ: ABCD
DEWGj: ABCD
Xf2qO: ABCD
ABCD: Fry
VIi4k: ABCD
EtlSL: ABCD
Un6vP: ABCD
PXnKM: ABCD
Thank you! It's almost perfect. what is lacking in the United States is the occasional situation of "ABCD: Fry.
Now, you can use the stupid method to filter out the results. first, for 10 times, you can obtain one correct one by one.
Follow up on this.
4 Characters in plaintext and 5 characters in ciphertext. for plaintext ABCD, the ciphertext ABCD is obviously missing one character.
function get_encode($s){ $en_s = encode($s); if($en_s == $s) { return get_encode($s); }else { return $en_s; }}
The recursion efficiency is better, and the knowledge of encryption and decryption algorithms is almost 0. after the project is completed, I will try it out. do you have any books to recommend!
Oh, I missed it.
Function decode ($ s) {$ d = str_split (DICT); $ len = count ($ d); $ r = ''; $ t = array_search ($ s {0}, $ d); for ($ I = 1; $ I
9 SpQl: ABCD
YDhBY: ABCD
LctwQ: ABCD
DEWGj: ABCD
Xf2qO: ABCD
ABCD: Fry
VIi4k: ABCD
EtlSL: ABCD
Un6vP: ABCD
PXnKM: ABCD
Thank you! It's almost perfect. what is lacking in the United States is the occasional situation of "ABCD: Fry.
Now, you can use the stupid method to filter out the results. first, for 10 times, you can obtain one correct one by one.
It is $ t = rand (0, $ len) during encryption; here it is wrong, it should be $ t = rand (0, $ len-1 );
Oh, I missed it.
Function decode ($ s) {$ d = str_split (DICT); $ len = count ($ d); $ r = ''; $ t = array_search ($ s {0}, $ d); for ($ I = 1; $ I
9 SpQl: ABCD
YDhBY: ABCD
LctwQ: ABCD
DEWGj: ABCD
Xf2qO: ABCD
ABCD: Fry
VIi4k: ABCD
EtlSL: ABCD
Un6vP: ABCD
PXnKM: ABCD
Thank you! It's almost perfect. what is lacking in the United States is the occasional situation of "ABCD: Fry.
Now, you can use the stupid method to filter out the results. first, for 10 times, you can obtain one correct one by one.
It is $ t = rand (0, $ len) during encryption; here it is wrong, it should be $ t = rand (0, $ len-1 );
No one answered the question in PHPCHINA for a few days. it was solved in these hours !! Thank you!