Php encryption and js decryption seem meaningless, mainly because Keys will be seen in js, however, the following function code may be used in some places. "123456" is an encrypted key and can be changed as needed.
Php encryption and js decryption seem meaningless, mainly because Keys will be seen in js.
However, it may be used in some places.
PHP encryption functions
The code is as follows:
Function strencode ($ string ){
$ String = base64_encode ($ string );
$ Key = md5 ('20140901 ');
$ Len = strlen ($ key );
$ Code = '';
For ($ I = 0; $ I <strlen ($ string); $ I ++ ){
$ K = $ I % $ len;
$ Code. = $ string [$ I] ^ $ key [$ k];
}
Return base64_encode ($ code );
}
Echo strencode ('abced Hello, I am your bit/s asd #$ )()*&*&*');
?>
Js decryption functions:
The code is as follows:
Script
Function strencode (string ){
Key = cal1_5 ('20140901 ');
String = Base64.decode (string );
Len = key. length;
Code = '';
For (I = 0; I <string. length; I ++ ){
K = I % len;
Code + = String. fromCharCode (string. charCodeAt (I) ^ key. charCodeAt (k ));
}
Return Base64.decode (code );
}
Alert (strencode ('pipeline = '));
Script
PHP encryption & JS decryption 2
The code is as follows:
If (! Function_exists (jm ))
{
Function jm ($ str ){
$ Len = strlen ($ str );
For ($ I = 0; $ I <$ len; $ I ++)
{
$ Ascc = ord ($ str [$ I]);
If ($ ascc <128)
{
$ Ascc = $ ascc ^ 7;
}
$ Res. = chr ($ ascc );
}
Return $ res;
} // End function
}
Echo "script"
Xflag = true;
Function xcount (xh ){
If (! Xflag) return;
Var xc = \ "\", xd = new Array (), xe = \ "\", xf = 0;
For (I = 0; I Xa = xh. charCodeAt (I );
If (xa <128) xa = xa ^ 7;
Xe + = String. fromCharCode (xa );
If (xe. length> 80 ){
Xd [xf ++] = xe; xe = \"\";
}
}
Xc = xd. join (\ "\") + xe;
Document. write (xc );
} Script ";
$ Check_count = addslashes (jm ("script" alert ('test ~~~ '); Script ");
$ Check_count ="