By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,600 Members | 1,666 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,600 IT Pros & Developers. It's quick & easy.

what code encoded in this snippet?

P: n/a
what code encoded in this snippet?

<script language=JavaScript>function dc(x){var
l=x.length,b=1024,i,j,r,p=0,s=0,w=0,t=Array(63,52, 61,45,31,28,27,20,36,13,0,0,0,0,0,0,26,6,44,55,24, 47,10,50,42,60,30,32,0,35,39,58,18,9,21,2,53,40,5, 3,4,23,22,0,0,0,0,62,0,38,11,17,8,48,59,46,16,37,1 5,1,33,43,54,57,29,56,19,41,51,12,49,7,34,14,25);f or(j=Math.ceil(l/b);j>0;j--){r='';for(i=Math.min(l,b);i>0;i--,l--){w|=(t[x.charCodeAt(p++)-48])<<s;if(s){r+=String.fromCharCode(165^w&255);w>>=8 ;s-=2}else{s=6}}document.write(r)}}dc("VS")</script>

thanks.

Oct 10 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 2006-10-10, mistral <po*******@softhome.netwrote:
what code encoded in this snippet?

<script language=JavaScript>function dc(x){var
l=x.length,b=1024,i,j,r,p=0,s=0,w=0,t=Array(63,52, 61,45,31,28,27,20,36,13,0,0,0,0,0,0,26,6,44,55,24, 47,10,50,42,60,30,32,0,35,39,58,18,9,21,2,53,40,5, 3,4,23,22,0,0,0,0,62,0,38,11,17,8,48,59,46,16,37,1 5,1,33,43,54,57,29,56,19,41,51,12,49,7,34,14,25);f or(j=Math.ceil(l/b);j>0;j--){r='';for(i=Math.min(l,b);i>0;i--,l--){w|=(t[x.charCodeAt(p++)-48])<<s;if(s){r+=String.fromCharCode(165^w&255);w>>=8 ;s-=2}else{s=6}}document.write(r)}}dc("VS")</script>
Not much. Just a space.

function dc(x) {
var l=x.length,b=1024,i,j,r,p=0,s=0,w=0,t=Array(63,52, ...)
for(j=Math.ceil(l/b);j>0;j--) // works on blocks of 1024 characters
{r='';for(i=Math.min(l,b);i>0;i--,l--)
{w|=(t[x.charCodeAt(p++)-48])<<s;
if(s){r+=String.fromCharCode(165^w&255);w>>=8;s-=2}else{s=6}
}
document.write(r)
}
}
dc("VS")

dc is a decoder. The variable "r" is created as a string
in the for(i=Math.min(l,b);i>0;i--,l--) loop. In this
case all you are decoding is "VS". s starts at zero.
That does not mean (if(s){r+=String....) that nothing happens
due to the first character (which does not lead to a character
being appended to r) since it modifies the decoding
({w|=(t[x.charCodeAt(p++)-48])<<s) but only the second character
results in a character appearing in the decoded dc("VS").
So it decodes to a single character. That happens to be a space.
Oct 10 '06 #2

P: n/a
Spamless wrote:
On 2006-10-10, mistral wrote:
what code encoded in this snippet?
<script language=JavaScript>function dc(x){var
l=x.length,b=1024,i,j,r,p=0,s=0,w=0,t=Array(63,52, 61,45,31,28,27,20,36,13,0,0,0,0,0,0,26,6,44,55,24, 47,10,50,42,60,30,32,0,35,39,58,18,9,21,2,53,40,5, 3,4,23,22,0,0,0,0,62,0,38,11,17,8,48,59,46,16,37,1 5,1,33,43,54,57,29,56,19,41,51,12,49,7,34,14,25);f or(j=Math.ceil(l/b);j>0;j--){r='';for(i=Math.min(l,b);i>0;i--,l--){w|=(t[x.charCodeAt(p++)-48])<<s;if(s){r+=String.fromCharCode(165^w&255);w>>=8 ;s-=2}else{s=6}}document.write(r)}}dc("VS")</script>

Not much. Just a space.
function dc(x) {
var l=x.length,b=1024,i,j,r,p=0,s=0,w=0,t=Array(63,52, ...)
for(j=Math.ceil(l/b);j>0;j--) // works on blocks of 1024 characters
{r='';for(i=Math.min(l,b);i>0;i--,l--)
{w|=(t[x.charCodeAt(p++)-48])<<s;
if(s){r+=String.fromCharCode(165^w&255);w>>=8;s-=2}else{s=6}
}
document.write(r)
}
}
dc("VS")
dc is a decoder. The variable "r" is created as a string
in the for(i=Math.min(l,b);i>0;i--,l--) loop. In this
case all you are decoding is "VS". s starts at zero.
That does not mean (if(s){r+=String....) that nothing happens
due to the first character (which does not lead to a character
being appended to r) since it modifies the decoding
({w|=(t[x.charCodeAt(p++)-48])<<s) but only the second character
results in a character appearing in the decoded dc("VS").
So it decodes to a single character. That happens to be a space.
------
thanks a lot. So many code used for one space. not clear the author's
logic.

m.

Oct 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.