html加密解密代码

html加密解密代码,第1张

<HTML><HEAD><TITLE>纯真过往-方宁 - 加密/解密HTML源代码</TITLE>

<META content="text/htmlcharset=gb2312" http-equiv=Content-Type>

<META content="script,windows" name=keywords>

<STYLE>.tablinks A {COLOR: blue}

.tablinks A:visited { COLOR: blue}

.tablinks A:hover {COLOR: brown}

input{ font-family: Tahomafont-size: 9ptcolor: #000080 }

body,textarea{ font-family: Tahomafont-size: 9ptcolor: blue}

</STYLE>

</HEAD>

<BODY bgColor=#D6D3CE leftMargin=0 marginwidth="0" scroll=no oncontextmenu="self.event.returnValue=false">

<div align="center">

<center>

<TABLE border=0 cellPadding=0 cellSpacing=0 width="600">

<TBODY>

<TR>

<TD align=left vAlign=top>

<div align="center" style="width: 598height: 42">

<div align="center">

<font color="#0066ff">加密页面源代码脚本</font>

</div>

<p><font color="#800000">将你的页面源代码粘贴在下面的框内,要包括所有的标签例如html

, head, body等。</font></p>

</div>

<P align=center> 

<P align=left><!--webbot bot="HTMLMarkup" startspan -->

<SCRIPT language=JavaScript>

var i=0

var ie=(document.all)?1:0

var ns=(document.layers)?1:0

function generate() /* Generation of "Compilation" */

{

code = document.pad.text.value

if (code)

{

document.pad.text.value='纯真过往-方宁正在加密中...请等待!'

setTimeout("compile()",1000)

}

else alert('纯真过往-方宁提醒您:还没有放入要加密的网页代码!')

}

function compile() /* The "Compilation" */

{

document.pad.text.value=''

compilation=escape(code)

document.pad.text.value="<script>\n<!--\ndocument.write(unescape(\""+compilation+"\"))\n//-->\n<\/script>"

i++

alert("(纯真过往)已将所选内容加密成功!请点预览查看效果!")

}

function selectCode() /* Selecting "Compilation" for Copying */

{

if(document.pad.text.value.length>0)

{

document.pad.text.focus()

document.pad.text.select()

}

else alert('纯真过往-方宁提醒您:没有任何内容可以选定!')

}

function preview() /* Preview for the "Compilation" */

{

if(document.pad.text.value.length>0)

{

pr=window.open("","Preview","scrollbars=1,menubar=1,status=1,width=700,height=320,left=50,top=110")

pr.document.write(document.pad.text.value)

}

else alert('纯真过往-方宁提醒您:没有任何内容可以预览!')

}

function uncompile() /* Decompiling a "Compilation" */

{

if (document.pad.text.value.length>0)

{

source=unescape(document.pad.text.value)

document.pad.text.value=""+source+""

}

else alert('纯真过往-方宁提醒您:请把你需要解密的代码放到此处!')

}

// -->

</SCRIPT>

<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">

<TBODY>

<TR>

<TD width="100%"><!-- Compilation Panel -->

<FORM method=post name=pad align="center"><TEXTAREA cols=58 name=text rows=11 style="BACKGROUND-COLOR: #f0f0f0width=100%"></TEXTAREA><BR><p align="center"><INPUT name=compileIt onclick=generate() type=button value=加密>

<INPUT name=select onclick=selectCode() type=button value=选定>

<INPUT name=view onclick=preview() type=button value=预览>

<INPUT name=retur onclick=uncompile() type=button value=解密>

<INPUT name=clear type=reset value=清除>

</FORM><!-- Compilation Panel --></TD></TR></TBODY></TABLE><!--webbot bot="HTMLMarkup" endspan -->

</table>

</center>

</div>

<p align="center"><a href=" http://www.lovehy.com" target="_blank">纯真过往-方宁

http://www.czgwnn.cn</a></p>

</BODY>

你可以选择一种JS加密算法,然后把HTML使用该算法加密,然后将解密算法连同加密结果一起保存到一个新的网页中.在解密算法中使用document.write方法将解密结果写到文档,可以实现简单的HTML源代码加密.

1、base64加密:在页面中引入base64.js文件,调用方法为:

2、md5加密:在页面中引用md5.js文件,调用方法为

3、sha1加密,据说这是最安全的加密:页面中引入sha1.js,调用方法为

base64.js: http://files.cnblogs.com/mofish/base64.js

md5.js: http://files.cnblogs.com/mofish/md5.js

sha1.js: http://files.cnblogs.com/mofish/sha1.js

我们可以知道:escape()除了 ASCII 字母、数字和特定的符号外,对传进来的字符串全部进行转义编码,因此如果想对URL编码,最好不要使用此方法。而encodeURI() 用于编码整个URI,因为URI中的合法字符都不会被编码转换。encodeURIComponent方法在编码单个URIComponent(指请求参数)应当是最常用的,它可以讲参数中的中文、特殊字符进行转义,而不会影响整个URL。

请注意 encodeURIComponent() 函数 与 encodeURI() 函数的区别之处,前者假定它的参数是 URI 的一部分(比如协议、主机名、路径或查询字符串)。因此 encodeURIComponent() 函数将转义用于分隔 URI 各个部分的标点符号。

一、encodeURI()//转义一个URI中的字符

语法:encodeURI(uri)//这个在编码不同的AJAX请求时,解决中文乱码问题经常用到。

二、decodeURI()//解码一个URI中的字符

语法:decodeURI(uri)

三、encodeURIComponent()//转义URI组件中的字符

四、decodeURIComponent()//解码一个URI组件中的字符

五、escape()//编码一个字符串

语法:escape(value)

六、unecape()//解码一个由escape()函数编码的字符串


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/6200648.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-17
下一篇 2023-03-17

发表评论

登录后才能评论

评论列表(0条)

保存