DarkBlizz

Tavern => Interesting Banter => Topic started by: Glyph on February 28, 2010, 09:44:59 PM

Title: Messing around with hackthissite.org level 6
Post by: Glyph on February 28, 2010, 09:44:59 PM
So I got really bored and decided to check this site out, I was initially very skeptical about having anything to do with this site.
Well, it turns out this site is pretty neat. You can pass a series of staged tests in order to gain points and get to new levels.

One level in particular that I would like to discuss involves very basic cryptography. This is level 6, where you are given an encrypted string, the generator, and an input to enter the decrypted string.

Now, in order to pass this level you have to understand what it's doing in the first place.

Try entering something simple like "1111".
You'll see it displays "1234".

This is a common method when testing types of encryption, you'll be able to spot consistencies and figure them out right away. (assuming they are simple. ROT13 (http://en.wikipedia.org/wiki/ROT13) uses a similar method.)

Now, you can probably already tell what it's doing to encrypt strings. Increasing each succeeding character by its index in the string.

Now, in order to decrypt this encryption, you obviously have to do the reverse. Just subtract the ascii character by that of its index in the string.


Below is an AutoIt script I wrote specifically for this level.

Global $string = "string", $x = StringLen($string), $buffer = "", $i=0, $leng=0
do
    $i+=1
    $char = StringMid($string, $i, 1)  ;select each char and parse it
    $asc = Asc($char) ;get the current ascii code
    $new = chr($asc-$leng) ;increase it by the index we are at
    $buffer=$buffer&$new ;apply the new character to the buffer
    $leng+=1
until $leng=$x

ConsoleWrite("Decrypted: " & $buffer & @CRLF)


Enjoy! If you're interested in AutoIt there are a few things that could be done better with this code, Feel free to play around with it.
Title: Re: Messing around with hackthissite.org level 6
Post by: Allmont on March 02, 2010, 09:59:46 AM
fun site, i don't think i ever made it past level 4.
Title: Re: Messing around with hackthissite.org level 6
Post by: jyim89 on March 29, 2010, 04:08:46 PM
Quote from: Allmont on March 02, 2010, 09:59:46 AM
fun site, i don't think i ever made it past level 4.

lol agrees.

This is as far as i got on this site =/
Basic: (1) (http://www.hackthissite.org/missions/basic/1/) (2) (http://www.hackthissite.org/missions/basic/2/) (3) (http://www.hackthissite.org/missions/basic/3/) (4) (http://www.hackthissite.org/missions/basic/4/) (5) (http://www.hackthissite.org/missions/basic/5/) (6) (http://www.hackthissite.org/missions/basic/6/) (7) (http://www.hackthissite.org/missions/basic/7/) (8) (http://www.hackthissite.org/missions/basic/8/) (9) (http://www.hackthissite.org/missions/basic/9/) (10) (http://www.hackthissite.org/missions/basic/10/)
  Realistic: (1) (http://www.hackthissite.org/missions/realistic/1/) (2) (http://www.hackthissite.org/missions/realistic/2/) (3) (http://www.hackthissite.org/missions/realistic/3/)
  Application: (1) (http://www.hackthissite.org/missions/application/#1) (2) (http://www.hackthissite.org/missions/application/#2)
  Javascript: (1) (http://www.hackthissite.org/missions/javascript/1/) (2) (http://www.hackthissite.org/missions/javascript/2/) (3) (http://www.hackthissite.org/missions/javascript/3/) (4) (http://www.hackthissite.org/missions/javascript/4/) (5) (http://www.hackthissite.org/missions/javascript/5/) (6) (http://www.hackthissite.org/missions/javascript/6/) (7) (http://www.hackthissite.org/missions/javascript/7/)
  Extbasic: (1) (http://www.hackthissite.org/missions/extbasic/1/)