Thru the Java Door
by WeLuv
18 February 1998

Fravia+, The JavaScript door protection. An excellent puzzle

which I must confess took me more than a little bit of time

to solve... here's how I got in

  

 1. Realized I could shut off JAVA in Netscape. Captured source 

  to file so I could play off line.

 2. Learned from your code how to write/input variables. Cut and 

  pasted from your code into the array building loop so I could 

  record the alpha-numeric values as they were computed. Next I

  did the same thing in the loop that "builds up" the final value

  of the entered string and is compared to 25834242042. Realized

  that char 1 is ignored. (A very nice little trick)

 3. The final value is an integer product of the number of characters

  entered. A little calculator work shows 9 is the only reasonable

  integer number of characters that can generate the final value.

 4. I actually started to code up a brute force attack. About 1/2 

  way thru that effort I did the 62 to the 9th thing as a sanity check.

  Forget it.....

 5. So I wrote a simple little loop in Qbasic that would "test"

  if an alpha-numeric guess was a legal guess and list all legal 

  preceeding characters. ...Legal being  definded here as a letter 

  that produces an integer in the next lower order loop of the 

  "build up" calculation.

 6.Using this little tool (5 above) I began to investigate (on paper)

  likely character sequences and throw out those that didn't make 

  "sense".  You said for example right from the beginning that the 

  NAME was related to the page....so a scrambled/random sequence 

  didn't seem likely. Besides...your intent wasn't to prevent

  everyone from gaining access.

 7.Via this thought process I got "ther" as the last 4 characters. 

  They seemed "right". Then I took my little Qbasic tool and cloned

  it,nested 5 deep. The essence of the code follows:

 

Set up data/arrays etc....then...

          

Found# = 0

Count = 0

char9 = 53

char8 = 40

char7 = 43

char6 = 55

REM char5 = 56...8522430 is what remains after unwinding "ther"

code5# = 8522430#



               FOR char5 = 10 TO 61

                code4# = (code5# / 5) - pram(char5)

                code4rem# = code4# / 4

                IF CLNG(code4rem#) = code4rem# THEN

                   FOR char4 = 10 TO 61

                   code3# = (code4# / 4) - pram(char4)

                   code3rem# = code3# / 3

                   IF CLNG(code3rem#) = code3rem# THEN

                      FOR char3 = 10 TO 61

                      code2# = (code3# / 3) - pram(char3)

                      code2rem# = code2# / 2

                      IF CLNG(code2rem#) = code2rem# THEN

                         FOR char2 = 10 TO 61

                         code1# = (code2# / 2) - pram(char2)

                         code1rem# = code1# / 1

                         IF CLNG(code1rem#) = code1# THEN

                            FOR char1 = 10 TO 61

                            IF code1rem# - pram(char1) = 0 THEN

Count = Count + 1

Found# = Found# + 1

Buffer(Count) = alpha(char1) + alpha(char2) + ........ alpha(char9)



REM groups of seven (full screen and eliminates a lot of disk work)

IF Count = 7 THEN

PRINT USING "##########.#"; Found#

PRINT #1, Buffer(1); " "; Buffer(2); " "; ............ Buffer(7)

PRINT ;   Buffer(1); " "; Buffer(2); " "; ............ Buffer(7)

Count = 0

END IF





What we're doing here is checking ahead by one character each time, ie

 does it lead to an integer solution? If not back up  out of that 

 branch and take another path. This eliminates the testing of

 many combinations which only lead to a non-solution anyway.





8.The two possiblities stood out from the trash very clearly.

  Got back to the entrance..entered my "solution" and entered the 

  dreaded 404 zone. hmmm....what/where did I go wrong ?

9.Did I miss code ?...am I getting nonsense etc ?. Looked at my 

  notes and concluded I've made no mistakes and what I've done

  thus far "feels" right (Zen?). Did this for a few evenings.

10.Back to entrance ...retried my previous solution and at 1st try

  here I am.! Turns out I was correct. Either I had misstyped or

  the mirror was "under construction". I think the latter having 

  read the Friday the 13th massacre posting.



Observations/Conclusions:

  Clearly no exhaustive search in a reasonable amount of time will

  yield results. Qbasic is not noted for it's speed but even so 

  the above code will give all valid 5 character sequences

  (approx 140)in 10 minutes at 200 MHz.  Note however that for

  all practical purposes I used the computer as a calculator and 

  "thought" my way back thru the last four characters. Only after

  having reduced the problem to a manageable size did I let it do 

  the tedious dirty work. And that to me is THE lesson here...



  Shut the computer off and THINK through the problem. 

  Don't rely upon processor speed.

            

  Humorous Anecdote:

  Girl Friend: You still working on that Fravia thing ??

  Responce: Yes

  Girl Friend: What do you get if you figure it out ??

  Responce: I get to do another puzzle  :)



Javascript page
Advanced JavaScript