如何解密/解码?

时间:2014-04-02 19:19:00

标签: javascript encryption

我正在努力应对挑战并解密一些东西...... 但我无法弄清楚它是什么样的加密方式。

<script>

function decrypt(inp) {
result = "";
for (var i=0; i<inp.length; i++) {
    result = result + String.fromCharCode(inp.charCodeAt(i) ^ "ENCRYPTED".charCodeAt(i %  9));
}
return result;
}

/*
 * Use this function to verify the security code
 */
eval(decrypt("O8& 06-eye(6<:$=**ef-'4|t61&-&!*yt>Nencr06tm07;&ryvrel+;.rp\u0019$0-  `3=.xfidugjrxmtudchcz7%9ebe\u0003\"&1~$*3m|orhy}eyxnsrvtm*0#cty\u001d51,k>,%qbxevlgcsdpdebcnk<,=tcd\b\/7:w ;2lwbcapytdye~ctp|+1(ner\u00141 -j5!4zk|tqmln~oy`tcbef-'4pre\t$:+|)?#mvinv{ppixdunetyx:0)ehc\u001f8$<k4*9k`upblmeo~riprcdm 6?yvt\b%1&m\"6'|wheyj{yqieteherq>!(dcn\u000e3-8z5+2fq~yh}lddscbyvrel+;.rp\u0019$0-`3=.xfid|gjrxmtudchcz7%9ebe\u0003\"&1~$*3m|orh`}lddscbyvrel+;.rp\u0019$0-`3=.xfidtj{ymieteherq>!(dcn\u000e3-8z5+2fq~yaflmes~riprcdm 6?yvt\b%1&m\"6'|whep{ppixdunetyx:0)ehc\u001f8$<k4*9k`upeqmln~oy`tcbef-'4pre\t$:+|)?#mvinrgpytxye~jr\"Z]L7 :\u0017;45;00m=61:5'6hesbiyoOM8n&>*5t>NLG\/=:1 ,++`175?5!lluI[$Z)OM"));



var enabled = true;
function handle() {
if (!enabled) {
    return;
}
if ($("#code").val().length >= 4) {
    verify(parseInt($("#code").val()), function() {
        var code = $("#code").val();
        $.post("/unlock.php", 
            { code: code, step: 3 },
            function(data) {
                if (data == "OK") {
                    document.location = "/4";
                } else {
                    $("#code").val('');
                }
            }
        );
    });
}

} Ĵ

这是源代码的一部分。 有谁能告诉我如何解密这个? 我确实找到了......但我不确定是否有必要。

/ * jquery.utils.js:各种简单的实用功能 - 2k12 CS  * /

(function($){

$.extend({

    postJSON: function(url, data, callback) { return $.post(url, data, callback, "json"); }, 

    base64_decode: function(input) {

        var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + 

            "abcdefghijklmnopqrstuvwxyz0123456789+/=";

        var output = ""; var chr1, chr2, chr3;

        var enc1, enc2, enc3, enc4; var i = 0;

        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

        while (i < input.length) {

            enc1 = keyStr.indexOf(input.charAt(i++));

            enc2 = keyStr.indexOf(input.charAt(i++));

            enc3 = keyStr.indexOf(input.charAt(i++));

            enc4 = keyStr.indexOf(input.charAt(i++));

            chr1 = (enc1 << 2) | (enc2 >> 4);

            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);

            chr3 = ((enc3 & 3) << 6) | enc4;

            output = output + String.fromCharCode(chr1);

            if (enc3 != 64) output = output + String.fromCharCode(chr2);

            if (enc4 != 64) output = output + String.fromCharCode(chr3);
        }

        return output;
    },

    format_time: function(value) {

        var minutes = Math.floor(parseInt(value) / 60);

        var seconds = parseInt(value) - minutes * 60;

        if (minutes < 10) minutes = '0' + minutes;

        if (seconds < 10) seconds = '0' + seconds;

        return minutes + ':' + seconds;
    },

    // return value seperated with dashes every $groupsize characters

    seperate: function(value, groupsize) {

        var splitexp = new RegExp(".{1," + $.xn(groupsize) + "}", "g");

        var trailexp = new RegExp("[^-]{" + $.xn(groupsize) + "}-$", "g");

        var groups = value.replace(/-/g, "").match(splitexp);

        if(!(groups)) return ""; 

        var result = groups.join("-");

        if(value.match(trailexp)) result += "-";

        return result;
    },

    debug: function(message) {

        if(typeof(console) == "undefined") return false;

        return console.log("[portal] " + message); 
    },

    xh: function(value) { 

        return value.replace(/&/g, '&amp;').replace(/</g, '&lt;')

               .replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/`/g, '&#96;');
    },

    xn: function(value) { return Number(value); }, 

    xw: function(value) { return value.replace(/[^a-zA-Z0-9_]/, '_'); }, 

    xclass: function(value, allow_spaces) {

        allow_spaces = allow_spaces || false; 

        if(allow_spaces) return value.replace(/[^ a-zA-Z0-9_-]/, '_');

        return value.replace(/[^a-zA-Z0-9_-]/, '_');
    },

    xu: function(value) {

        return encodeURIComponent(value).replace(/!/g, '%21')

            .replace(/'/g, '%27').replace(/\(/g, '%28')

            .replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/`/g, '%60');

    } });

})(jQuery的);

我有人能告诉我如何解密这个会很棒!

0 个答案:

没有答案