PHP PHP JavaScript ROT13编码器功能

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP PHP JavaScript ROT13编码器功能相关的知识,希望对你有一定的参考价值。

/**
 * Returns a rot13 encrypted string as well as a JavaScript decoder function.
 * @param string $inputString The string to encrypt
 * @return string An encoded javascript function
 */

function js_rot13_encode($inputString) {
	$rotated = str_replace('"','\"',str_rot13($inputString));
	return <<<EOF
		 <script type="text/javascript">
		/*<![CDATA[*/
		document.write("$rotated".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);}));
		/*]]>*/
		</script>

EOF;
// N.B Make sure there are no whitespace or extra characters following the semicolon above!
}

// ========
// = Demo =
// ========

echo js_rot13_encode('<a href="mailto:user@host.com">user@host.com</a>');
echo js_rot13_encode('user@host.com');

以上是关于PHP PHP JavaScript ROT13编码器功能的主要内容,如果未能解决你的问题,请参考以下文章

php 解密eval(gzinflate(str_rot13(base64_decode

[php代码审计] php://filter

javascript ROT13

rot13加密

rot13加密

ROT13 加密与解密