Cenzic 232 Patent
Paid Advertising
sla.ckers.org is
ha.ckers sla.cking
Sla.ckers.org
Script obfuscation, filter evasion, IDS/IPS/WAF bypassing... this is where it should live. Because this topic is too big to live anywhere else. Phj33r! 
Go to Topic: PreviousNext
Go to: Forum ListMessage ListNew TopicSearchLog In
Pages: Previous12
Current Page: 2 of 2
Re: 140bytes challenges
Posted by: LeverOne
Date: June 10, 2011 08:35AM

Jonas, you unleashed a few knots in the excellent work by noma, well done!

another:

a[d++]||(b='=')&&e --> a[d++]||(b='=',e)


// 110

function(a,b,c,d,e,f){for(d=f='';e&=3,a[d++]||(b='=',e);f+=b[63&c>>++e*2])c=c<<8|a.charCodeAt(d-=!e);return f}

----------------------
~Veritas~



Edited 2 time(s). Last edit at 06/10/2011 09:08AM by LeverOne.

Options: ReplyQuote
Re: 140bytes challenges
Posted by: Gareth Heyes
Date: June 10, 2011 10:57AM

Every time I open this thread I can't believe it. Nice work all of you

------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]

Options: ReplyQuote
Re: 140bytes challenges
Posted by: noma
Date: June 10, 2011 01:25PM

Wow,
just amazing, really really nice

Options: ReplyQuote
Re: 140bytes challenges
Posted by: LeverOne
Date: June 14, 2011 01:24AM

Base64 decoder

116:
function(a,b,c,d,e){for(e='';~(c=c<<6|b.indexOf(a[d|=0]));d++%4?e+=String.fromCharCode(c>>(-d&3)*2&255):0);return e}

//added later
115:
function(a,b,c,d,e){for(e='';~(c=c<<6|b.indexOf(a[d|=0]));d++%4?e+=String.fromCharCode(c>>(d*6&6)&255):0);return e}


Notes:

1. Why not "search" ?

1) alert("+".search("+"));
2) ~(c=c<<6|b.search(a[d|=0])) <-- obviously endless loop if input data w/o "=", as we see in older versions here [gist.github.com]

2. It's still the incorrect decoder.

Quote
http://tools.ietf.org/html/rfc2045

Any characters outside of the base64 alphabet are to be ignored in
base64-encoded data.

Join! :)


Correct decoder

130:
function(a,b,c,d,e,f){f=e='';for(d in a)~(d=b.indexOf(a[+d]))&&(c=d|c<<6,f++%4)?e+=String.fromCharCode(c>>(f*6&6)&255):0;return e}

Notes:

1. a[+d] - to exclude custom prototypic methods/properties.

2.
Quote
http://tools.ietf.org/html/rfc2045
Because it is used only for padding at the end of the data, the
occurrence of any "=" characters may be taken as evidence that the
end of the data has been reached (without truncation in transit).
In this implementation "=" character is not regarded as an end of the data. Therefore, input "YWJ=j" will be decoded as "abc".

Example:
alert(b64decode('YW %-) Jj','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'))

To encode/decode UTF-8 string you can use this solution:

alert(decodeURI(escape(b64decode('0YLQtdGB0YI=','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'))))
alert(b64encode(unescape(encodeURI('\u0442\u0435\u0441\u0442')),'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'))

[ecmanaut.blogspot.com]

----------------------
~Veritas~



Edited 8 time(s). Last edit at 01/26/2012 07:09AM by LeverOne.

Options: ReplyQuote
Re: 140bytes challenges
Posted by: LeverOne
Date: January 26, 2012 04:07AM

// 109
function(a,b,c,d,e){for(d=e='';a[d|0]||(b='=',d%1);e+=b[63&c>>8-d%1*8])c=c<<8|a.charCodeAt(d-=-.75);return e}

----------------------
~Veritas~



Edited 1 time(s). Last edit at 01/26/2012 04:09AM by LeverOne.

Options: ReplyQuote
Pages: Previous12
Current Page: 2 of 2


Sorry, only registered users may post in this forum.