help to decode cryptic function

Discussion in 'JavaScript' started by matteoganz, Jan 29, 2010.

  1. #1
    Hello there,
    I need a little help from javascript gurus here:

    what does the following hiding/cryptic function translates to ?

    (function(c){f=0; for (i in c) f = c = (f-c); return String.fromCharCode.apply(null, c);})([-122, 25, -1, -7, 7, -19])+'coders@gmail.com'

    it surely hides a email address.
    can you decode it, please ?

    many thanks,
    regards.
    Matteo

     
    matteoganz, Jan 29, 2010 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Following code will be helpful to understand it better..

    Explanation:
    It takes an array as input.
    1. Begins with first character, finds its modulus and treating it as ascii, finds its actual character.
    2. For next, it deducts value from the previous one, and step 1 is followed for the same.
    3. Finally the array is converted in sequence of character, a character array, and is returned back.


    
    <html>
    <head>
    <script type="text/javascript">
    function get_email(array)
    {
    	f = 0;
    	for(i in array)
    	{
    		f = array[i] = (f - array[i]);
    	}
    	return String.fromCharCode.apply(null, array);
    }
    </script>
    </head>
    <body onload="alert(get_email([-109, 12, -18, -1, 15, -13])+'munj@gmail.com');">
    	<a href="javascript:alert(get_email([-109, 12, -18, -1, 15, -13])+'munj@gmail.com');">Do It</a>
    </body>
    </html>
    
    
    HTML:
     
    mastermunj, Jan 29, 2010 IP
  3. matteoganz

    matteoganz Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah ! Thanks !
     
    matteoganz, Jan 29, 2010 IP