国产综合精品在线,精品一区国产精品,中文在线欧美日韩视频,中文字幕制服亚洲另类

<dfn id="ykamo"><pre id="ykamo"></pre></dfn>
  • <rt id="ykamo"><code id="ykamo"></code></rt>
  • <strike id="ykamo"></strike>
    加密解密 Base64 and URL and Hex Encoding and Decoding
    來(lái)源:易賢網(wǎng) 閱讀:1459 次 日期:2016-11-14 10:17:40
    溫馨提示:易賢網(wǎng)小編為您整理了“加密解密 Base64 and URL and Hex Encoding and Decoding”,方便廣大網(wǎng)友查閱!

    今天想換一下Discuz論壇的風(fēng)格,誰(shuí)知下載風(fēng)格文件后,發(fā)現(xiàn)竟然是通過(guò)Base64加密過(guò)的   
    小林給推薦了個(gè)解密的頁(yè)面,提取出代碼如下: 
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
    <html>  
    <head>  
    <title>Base64 and URL and Hex Encoding and Decoding</title>  
    <meta name="description" content="Encodes or decodes data in Base64 or URL encoding using client side JavaScript" />  
    <meta name="keywords" content="base64, base 64, urlencode, urldecode, hexencode, hex encode, hexdecode hex decode, javascript base64, javascript base 64, javascript urlencode, javascript urldecode, javascript hexencode, javascript hexdecode" />  
    <link rel="shortcut icon" href="http://ostermiller.org/favicon.ico" type="image/x-icon" />  
    <script language=javascript type="text/javascript">  
    <!--  
    function urlDecode(str){  
     str=str.replace(new RegExp('\\+','g'),' ');  
     return unescape(str);  
    }  
    function urlEncode(str){  
     str=escape(str);  
     str=str.replace(new RegExp('\\+','g'),'%2B');  
     return str.replace(new RegExp('%20','g'),'+');  
    }  
    var END_OF_INPUT = -1;  
    var base64Chars = new Array(  
     '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','+','/'  
    );  
    var reverseBase64Chars = new Array();  
    for (var i=0; i < base64Chars.length; i++){  
     reverseBase64Chars[base64Chars[i]] = i;  
    }  
    var base64Str;  
    var base64Count;  
    function setBase64Str(str){  
     base64Str = str;  
     base64Count = 0;  
    }  
    function readBase64(){   
     if (!base64Str) return END_OF_INPUT;  
     if (base64Count >= base64Str.length) return END_OF_INPUT;  
     var c = base64Str.charCodeAt(base64Count) & 0xff;  
     base64Count++;  
     return c;  
    }  
    function encodeBase64(str){  
     setBase64Str(str);  
     var result = '';  
     var inBuffer = new Array(3);  
     var lineCount = 0;  
     var done = 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;  
     }  
     }  
     return result;  
    }  
    function readReverseBase64(){   
     if (!base64Str) return END_OF_INPUT;  
     while (true){   
     if (base64Count >= base64Str.length) return END_OF_INPUT;  
     var nextCharacter = base64Str.charAt(base64Count);  
     base64Count++;  
     if (reverseBase64Chars[nextCharacter]){  
     return reverseBase64Chars[nextCharacter];  
     }  
     if (nextCharacter == 'A') return 0;  
     }  
     return END_OF_INPUT;  
    }  
    function ntos(n){  
     n=n.toString(16);  
     if (n.length == 1) n="0"+n;  
     n="%"+n;  
     return unescape(n);  
    }  
    function decodeBase64(str){  
     setBase64Str(str);  
     var result = "";  
     var inBuffer = new Array(4);  
     var done = 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;  
     }  
     }  
     return result;  
    }  
    var digitArray = new Array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f');  
    function toHex(n){  
     var result = ''  
     var start = true;  
     for (var i=32; i>0;){  
     i-=4;  
     var digit = (n>>i) & 0xf;  
     if (!start || digit != 0){  
     start = false;  
     result += digitArray[digit];  
     }  
     }  
     return (result==''?'0':result);  
    }  
    function pad(str, len, pad){  
     var result = str;  
     for (var i=str.length; i<len; i++){  
     result = pad + result;  
     }  
     return result;  
    }  
    function encodeHex(str){  
     var result = "";  
     for (var i=0; i<str.length; i++){  
     result += pad(toHex(str.charCodeAt(i)&0xff),2,'0');  
     }  
     return result;  
    }  
    function decodeHex(str){  
     str = str.replace(new RegExp("s/[^0-9a-zA-Z]//g"));  
     var result = "";  
     var nextchar = "";  
     for (var i=0; i<str.length; i++){  
     nextchar += str.charAt(i);  
     if (nextchar.length == 2){  
     result += ntos(eval('0x'+nextchar));  
     nextchar = "";  
     }  
     }  
     return result;  
    }  
    //--></script>  
    </head>  
    <body>  
    <form name=code onsubmit="return false()">  
    <textarea name=text style='width:100%;height:75%;' onfocus='if (this.value=="Enter text to encode or decode here."){this.value="";}'>Enter text to encode or decode here.</textarea>  
    <table>  
    <tr><td align=center>  
    <input value="Encode" type=button onclick="document.code.text.value=urlEncode(document.code.text.value);">  
    </td><td align=center>  
    URL  
    </td><td align=center>  
    <input value="Decode" type=button onclick="document.code.text.value=urlDecode(document.code.text.value);">  
    </td></tr>  
    <tr><td align=center>  
    <input value="Encode" type=button onclick="document.code.text.value=encodeBase64(document.code.text.value);">  
    </td><td align=center>  
    Base 64  
    </td><td align=center>  
    <input value="Decode" type=button onclick="document.code.text.value=decodeBase64(document.code.text.value);">  
    </td></tr>  
    <tr><td align=center>  
    <input value="Encode" type=button onclick="document.code.text.value=encodeHex(document.code.text.value);">  
    </td><td align=center>  
    Hex  
    </td><td align=center>  
    <input value="Decode" type=button onclick="document.code.text.value=decodeHex(document.code.text.value);">  
    </td></tr>  
    <tr><td align=center>  
    </td><td align=center>  
    <input type=reset value=Clear>  
    </td><td align=center>  
    </td></tr>  
    </table>  
    </form>  
    <hr>  
    Base64 encode/decode was ported from a <a href="http://ostermiller.org/utils/Base64.html">Java Base64 encoder/decoder</a>.<br>  
    Base64 encode/decode was ported to <a href="http://ostermiller.org/base64_actionscript.html">Macromedia Actionscript</a>.<br>  
    <h3>License</h3>  
    <p>This program is free software; you can redistribute it and/or modify it  
    under the terms of the GNU General Public License as published by the Free  
    Software Foundation; either version 2 of the License, or (at your option)  
    any later version.</p>  
    <p>This program is distributed in the hope that it will be useful,  
    but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY  
    or FITNESS FOR A PARTICULAR PURPOSE. See the  
    <a href="http://www.gnu.org/copyleft/gpl.html">GNU  
    General Public License</a> for more details.</p>  
    <div style="padding:0.2cm;"><a href="http://ostermiller.org/calc/">More converters, calculators, and other JavaScript goodies</a></div>  
    <div style="padding:0.2cm;text-align:right;"><a href="http://ostermiller.org/">ostermiller.org</a> (<a href="http://ostermiller.org/siteindex.html">site index</a>)</div>  
    <div style="padding:0.2cm;"><p>Copyright <a href="http://ostermiller.org/contact.pl?regarding=JavaScript+Encoding" class=mail>Stephen Ostermiller</a> 2003-2006</p></div>  
    </body>  
    </html> 

    更多信息請(qǐng)查看網(wǎng)絡(luò)編程
    下一篇:ASP代碼加密
    易賢網(wǎng)手機(jī)網(wǎng)站地址:加密解密 Base64 and URL and Hex Encoding and Decoding
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢(xún)回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門(mén)公布的正式信息和咨詢(xún)?yōu)闇?zhǔn)!

    2025國(guó)考·省考課程試聽(tīng)報(bào)名

    • 報(bào)班類(lèi)型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢(xún) | 簡(jiǎn)要咨詢(xún)須知 | 加入群交流 | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專(zhuān)用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢(xún)關(guān)注公眾號(hào):hfpxwx
    咨詢(xún)QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專(zhuān)用圖標(biāo)