Tavern > Interesting Banter

Messing around with hackthissite.org level 6

(1/1)

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.

--- Code: ---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)

--- End code ---

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.

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.

--- End quote ---

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)

Navigation

[0] Message Index

It appears that you have not registered with DarkBlizz - Making Battle.net Magic -. To register, please click here...
Go to full version