关于加密解密 Base64 and URL and Hex Encoding and Decoding

2023-12-07 0 281

今天想换一下Discuz论坛的风格,谁知下载风格文件后,发现竟然是通过Base64加密过的 小林给推荐了个解密的页面,提取出代码如下: 复制代码 代码如下:<!DOCTYPEhtmlPUBLIC\”-//W3C//DTDHTML4.01Transitional//EN\”> <html> <head> <title>Base64andURLandHexEncodingandDecoding</title> <metaname=\”description\”content=\”EncodesordecodesdatainBase64orURLencodingusingclientsideJavaScript\”/> <metaname=\”keywords\”content=\”base64,base64,urlencode,urldecode,hexencode,hexencode,hexdecodehexdecode,javascriptbase64,javascriptbase64,javascripturlencode,javascripturldecode,javascripthexencode,javascripthexdecode\”/> <linkrel=\”shortcuticon\”href=\”http://ostermiller.org/favicon.ico\”type=\”image/x-icon\”/> <scriptlanguage=javascripttype=\”text/javascript\”> <!– functionurlDecode(str){ str=str.replace(newRegExp(\’\\\\+\’,\’g\’),\’\’); returnunescape(str); } functionurlEncode(str){ str=escape(str); str=str.replace(newRegExp(\’\\\\+\’,\’g\’),\’%2B\’); returnstr.replace(newRegExp(\’%20\’,\’g\’),\’+\’); } varEND_OF_INPUT=-1; varbase64Chars=newArray( \’A\’,\’B\’,\’C\’,\’D\’,\’E\’,\’F\’,\’G\’,\’H\’, \’I\’,\’J\’,\’K\’,\’L\’,\’M\’,\’N\’,\’O\’,\’P\’, \’Q\’,\’R\’,\’S\’,\’T\’,\’U\’,\’V\’,\’W\’,\’X\’, \’Y\’,\’Z\’,\’a\’,\’b\’,\’c\’,\’d\’,\’e\’,\’f\’, \’g\’,\’h\’,\’i\’,\’j\’,\’k\’,\’l\’,\’m\’,\’n\’, \’o\’,\’p\’,\’q\’,\’r\’,\’s\’,\’t\’,\’u\’,\’v\’, \’w\’,\’x\’,\’y\’,\’z\’,\’0\’,\’1\’,\’2\’,\’3\’, \’4\’,\’5\’,\’6\’,\’7\’,\’8\’,\’9\’,\’+\’,\’/\’ ); varreverseBase64Chars=newArray(); for(vari=0;i<base64Chars.length;i++){ reverseBase64Chars[base64Chars[i]]=i; } varbase64Str; varbase64Count; functionsetBase64Str(str){ base64Str=str; base64Count=0; } functionreadBase64(){ if(!base64Str)returnEND_OF_INPUT; if(base64Count>=base64Str.length)returnEND_OF_INPUT; varc=base64Str.charCodeAt(base64Count)&0xff; base64Count++; returnc; } functionencodeBase64(str){ setBase64Str(str); varresult=\’\’; varinBuffer=newArray(3); varlineCount=0; vardone=false; while(!done&&(inBuffer[0]=readBase64())!=END_OF_INPUT){ inBuffer[1]=readBase64(); inBuffer[2]=readBase64(); result+=(base64Chars[inBuffer[0]>>2]); if(inBuffer[1]!=END_OF_INPUT){ result+=(base64Chars[((inBuffer[0]<<4)&0x30)|(inBuffer[1]>>4)]); if(inBuffer[2]!=END_OF_INPUT){ result+=(base64Chars[((inBuffer[1]<<2)&0x3c)|(inBuffer[2]>>6)]); result+=(base64Chars[inBuffer[2]&0x3F]); }else{ result+=(base64Chars[((inBuffer[1]<<2)&0x3c)]); result+=(\’=\’); done=true; } }else{ result+=(base64Chars[((inBuffer[0]<<4)&0x30)]); result+=(\’=\’); result+=(\’=\’); done=true; } lineCount+=4; if(lineCount>=76){ result+=(\’\\n\’); lineCount=0; } } returnresult; } functionreadReverseBase64(){ if(!base64Str)returnEND_OF_INPUT; while(true){ if(base64Count>=base64Str.length)returnEND_OF_INPUT; varnextCharacter=base64Str.charAt(base64Count); base64Count++; if(reverseBase64Chars[nextCharacter]){ returnreverseBase64Chars[nextCharacter]; } if(nextCharacter==\’A\’)return0; } returnEND_OF_INPUT; } functionntos(n){ n=n.toString(16); if(n.length==1)n=\”0\”+n; n=\”%\”+n; returnunescape(n); } functiondecodeBase64(str){ setBase64Str(str); varresult=\”\”; varinBuffer=newArray(4); vardone=false; while(!done&&(inBuffer[0]=readReverseBase64())!=END_OF_INPUT &&(inBuffer[1]=readReverseBase64())!=END_OF_INPUT){ inBuffer[2]=readReverseBase64(); inBuffer[3]=readReverseBase64(); result+=ntos((((inBuffer[0]<<2)&0xff)|inBuffer[1]>>4)); if(inBuffer[2]!=END_OF_INPUT){ result+=ntos((((inBuffer[1]<<4)&0xff)|inBuffer[2]>>2)); if(inBuffer[3]!=END_OF_INPUT){ result+=ntos((((inBuffer[2]<<6)&0xff)|inBuffer[3])); }else{ done=true; } }else{ done=true; } } returnresult; } vardigitArray=newArray(\’0\’,\’1\’,\’2\’,\’3\’,\’4\’,\’5\’,\’6\’,\’7\’,\’8\’,\’9\’,\’a\’,\’b\’,\’c\’,\’d\’,\’e\’,\’f\’); functiontoHex(n){ varresult=\’\’ varstart=true; for(vari=32;i>0;){ i-=4; vardigit=(n>>i)&0xf; if(!start||digit!=0){ start=false; result+=digitArray[digit]; } } return(result==\’\’?\’0\’:result); } functionpad(str,len,pad){ varresult=str; for(vari=str.length;i<len;i++){ result=pad+result; } returnresult; } functionencodeHex(str){ varresult=\”\”; for(vari=0;i<str.length;i++){ result+=pad(toHex(str.charCodeAt(i)&0xff),2,\’0\’); } returnresult; } functiondecodeHex(str){ str=str.replace(newRegExp(\”s/[^0-9a-zA-Z]//g\”)); varresult=\”\”; varnextchar=\”\”; for(vari=0;i<str.length;i++){ nextchar+=str.charAt(i); if(nextchar.length==2){ result+=ntos(eval(\’0x\’+nextchar)); nextchar=\”\”; } } returnresult; } //–></script> </head> <body> <formname=codeonsubmit=\”returnfalse()\”> <textareaname=textstyle=\’width:100%;height:75%;\’onfocus=\’if(this.value==\”Entertexttoencodeordecodehere.\”){this.value=\”\”;}\’>Entertexttoencodeordecodehere.</textarea> <table> <tr><tdalign=center> <inputvalue=\”Encode\”type=buttononclick=\”document.code.text.value=urlEncode(document.code.text.value);\”> </td><tdalign=center> URL </td><tdalign=center> <inputvalue=\”Decode\”type=buttononclick=\”document.code.text.value=urlDecode(document.code.text.value);\”> </td></tr> <tr><tdalign=center> <inputvalue=\”Encode\”type=buttononclick=\”document.code.text.value=encodeBase64(document.code.text.value);\”> </td><tdalign=center> Base64 </td><tdalign=center> <inputvalue=\”Decode\”type=buttononclick=\”document.code.text.value=decodeBase64(document.code.text.value);\”> </td></tr> <tr><tdalign=center> <inputvalue=\”Encode\”type=buttononclick=\”document.code.text.value=encodeHex(document.code.text.value);\”> </td><tdalign=center> Hex </td><tdalign=center> <inputvalue=\”Decode\”type=buttononclick=\”document.code.text.value=decodeHex(document.code.text.value);\”> </td></tr> <tr><tdalign=center> </td><tdalign=center> <inputtype=resetvalue=Clear> </td><tdalign=center> </td></tr> </table> </form> <hr> Base64encode/decodewasportedfroma<ahref=\”http://ostermiller.org/utils/Base64.html\”>JavaBase64encoder/decoder</a>.<br> Base64encode/decodewasportedto<ahref=\”http://ostermiller.org/base64_actionscript.html\”>MacromediaActionscript</a>.<br> <h3>License</h3> <p>Thisprogramisfreesoftware;youcanredistributeitand/ormodifyit underthetermsoftheGNUGeneralPublicLicenseaspublishedbytheFree SoftwareFoundation;eitherversion2oftheLicense,or(atyouroption) anylaterversion.</p> <p>Thisprogramisdistributedinthehopethatitwillbeuseful, butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyofMERCHANTABILITY orFITNESSFORAPARTICULARPURPOSE.Seethe <ahref=\”http://www.gnu.org/copyleft/gpl.html\”>GNU GeneralPublicLicense</a>formoredetails.</p> <divstyle=\”padding:0.2cm;\”><ahref=\”http://ostermiller.org/calc/\”>Moreconverters,calculators,andotherJavaScriptgoodies</a></div> <divstyle=\”padding:0.2cm;text-align:right;\”><ahref=\”http://ostermiller.org/\”>ostermiller.org</a>(<ahref=\”http://ostermiller.org/siteindex.html\”>siteindex</a>)</div> <divstyle=\”padding:0.2cm;\”><p>Copyright<ahref=\”http://ostermiller.org/contact.pl?regarding=JavaScript+Encoding\”class=mail>StephenOstermiller</a>2003-2006</p></div> </body> </html>

您可能感兴趣的文章:

  • 关于base64加密/解密
  • vbs版的解密base64加密的脚本
  • Js base64 加密解密介绍
  • python字符串加密解密的三种方法分享(base64 win32com)
  • php使用base64加密解密图片示例分享
  • java常用工具类之DES和Base64加密解密类
  • php中base64_decode与base64_encode加密解密函数实例
  • C#实现基于Base64的加密解密类实例
  • C#编写的Base64加密和解密类

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 脚本加解密 关于加密解密 Base64 and URL and Hex Encoding and Decoding https://www.u-9.cn/biancheng/jbjjm/125940.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务