Need help with javascript

ultrex

Newbie
Joined
Oct 26, 2009
Messages
1
Reaction score
0
Can anyone help me with this javascript?

It's a decoding function, can anyone create encoding function based on it?


Code:
chr13: function(chr14) {
        var chr15 = "";
        var chr16 = 23;
        chr14 = unescape(chr14);
        chr17_ = chr14.replace(/[\D]/gi, "");
        for (i = 0; i < chr17_.length; i += 2) {
            chr18 = parseInt(chr17_.substr(i, [2])) + chr16;
            chr18 = unescape('%' + chr18.toString(16));
            chr15 += chr18;
        }
        chr14 = unescape(chr15);
        output = new String;
        chr19 = new Array();
        chr20 = new Array();
        chr21 = chr14.length;
        for (i = 0; i < chr21; i++) {
            chr19[i] = chr14.charCodeAt(i);
            chr20[i] = chr14.charCodeAt(i + 1);
        }
        for (i = 0; i < chr21; i = i + 2) {
            output += String.fromCharCode(chr19[i] - chr20[i]);
        }
        return output;
    }
Hope someone can help me
 

AgentOrange_MkUltra

Junior Member
Joined
May 29, 2009
Messages
179
Reaction score
44
Programming is about explaining to the computer how to get from A to B in abstract.
You should post input and output samples....:D


BTW this may bring some result (it is just random editing, without sample of coded / decoded text we can't do anything).


Code:
chr13: function(chr14) {
        var chr15 = "";
        var chr16 = 23;
        chr14 = escape(chr14);
//        chr17_ = chr14.replace(/[\D]/gi, "");
        for (i = 0; i < chr17_.length; i += 2) {
            chr18 = parseInt(chr17_.substr(i, [2])) + chr16;
            chr18 = escape('%' + chr18.toString(16));
            chr15 += chr18;
        }
        chr14 = escape(chr15);
        output = new String;
        chr19 = new Array();
        chr20 = new Array();
        chr21 = chr14.length;
        for (i = 0; i < chr21; i++) {
            chr19[i] = chr14.charCodeAt(i);
            chr20[i] = chr14.charCodeAt(i + 1);
        }
        for (i = 0; i < chr21; i = i + 2) {
            output += String.fromCharCode(chr19[i] - chr20[i]);
        }
        return output;
    }
 
Last edited:
Top