Messing around with hackthissite.org level 6

Started by Glyph, February 28, 2010, 09:44:59 PM

Previous topic - Next topic

Glyph

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 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.

Blizzard Fansite: BlizzForge.org

Allmont

fun site, i don't think i ever made it past level 4.

jyim89

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) (2) (3) (4) (5) (6) (7) (8) (9) (10)
  Realistic: (1) (2) (3)
  Application: (1) (2)
  Javascript: (1) (2) (3) (4) (5) (6) (7)
  Extbasic: (1)