Author
| MSX Puzzle of the day - Solve this!
|
NYYRIKKI msx master Posts: 1528 | Posted: September 21 2004, 22:11   |
I've seen, that there are quite a few MSX gurus around here, so I decited to launch a small competition, where you need to use brains as well as programming skils.
Who ever solves the following word puzzle first, will get huge amount of fame and respect.  You just need to be first, who sents a reply here with the correct answer.
Here are the rules:
- The word, that I search is written all in lower case
- It is english word
- The ASCII checksum of the word is 524
and here comes the nasty one:
- If you type in BASIC:
SET PASSWORD "produce"
... you can login to your MSX using this word as password!
Happy hunting!
|
|
ricbit msx lover Posts: 116 | Posted: September 21 2004, 22:47   |
I deduce the word has 5 characters.
|
|
manuel msx guru Posts: 3545 | Posted: September 21 2004, 23:42   |
Is it... "brain"?  |
|
GuyveR800 msx guru Posts: 3048 | Posted: September 21 2004, 23:47   |
really professional cheating, manuel 
(live on #msxdev ^_^) |
|
manuel msx guru Posts: 3545 | Posted: September 21 2004, 23:53   |
<wouter_> it's not cheating at all, just beiing smart
|
|
manuel msx guru Posts: 3545 | Posted: September 21 2004, 23:59   |
This is how I did it:
- ASCII a=97, ASCII z=122. Divide 524 by 97 and 122 and you know the amount of characters is between about 4.29 and 5.4 characters, i.e. 5
- use a Perl script to generate all combinations of characters that sum up to 524:
for (my $i=0; $i<26; $i++)
{
for (my $j=0; $j<26; $j++)
{
for (my $k=0; $k<26; $k++)
{
for (my $l=0; $l<26; $l++)
{
for (my $m=0; $m<26; $m++)
{
if (($i+$j+$k+$l+$m+(5*97)) == 524 )
{
print chr($i+97).chr($j+97).chr($k+97).chr($l+97).chr($m+97)."\n";
}
}
}
}
}
}
and output the results to crack.txt:
perl crack.pl > crack.txt
- compare the 111510 candidates with a list of english words:
cat american-english crack.txt | sort | uniq -d
The list comes from a Linux dictionary program and the result is only 64 words
- Try all 64 words.
Thanks for the very nice puzzle, NYYRIKKI! Please explain us the hashing algo now  |
|
manuel msx guru Posts: 3545 | Posted: September 22 2004, 00:05   |
Thanks by the way to Patriek for giving the 5-letters idea and Wouter for helping me remember the filtering trick with sort and uniq and providing me with the word list, which is somehow not installed on my own Linux box.  |
|
NYYRIKKI msx master Posts: 1528 | Posted: September 22 2004, 07:54   |
Quote:
| Is it... "brain"? 
|
Yes, we have a winner  That was fast, only 1.5h !
Quote:
| Thanks for the very nice puzzle, NYYRIKKI! Please explain us the hashing algo now 
|
Well, I let someone else to explain, but below is the hash program, that I used. I think, that you tested the possibilitys by hand, but you could have searched the algorithm from your MSX.
Few tips to do that: Password is MSX2 feature, so look from SUB-ROM. You can see text "Password:" when you enter one. That is good string to search. When you find the code, disassemble it. If you have SUPER-X this is not hard.
Anyway... here is the ready to compile program for BASIC:
DEFB #FE
DEFW BEGIN
DEFW END
DEFW START
ORG #C000
USR0: EQU #F39A
USR: EQU #F7F8
VALTYP: EQU #F663
BEGIN:
START:
LD HL,CODE
LD (USR0),HL
RET
CODE:
LD A,(VALTYP)
CP 2
LD HL,(USR)
LD A,(HL)
INC HL
JR Z,XBASIC ; USR(VARPTR(X$)) in XBASIC
LD E,(HL) ; USR(X$) in BASIC
INC HL
LD D,(HL)
EX DE,HL
XBASIC:
CALL HASH
LD A,2
LD (VALTYP),A
LD (USR),DE
RET
HASH:
LD DE,0000H
LD C,A
OR A
RET Z
SCF
X2E08H: PUSH AF
X2E09H: LD B,08H
X2E0BH: POP AF
PUSH AF
JR NC,X2E11H
RLC (HL)
X2E11H: RL E
RL D
JR NC,X2E1FH
LD A,D
XOR 80H
LD D,A
LD A,E
XOR 05H
LD E,A
X2E1FH: DJNZ X2E0BH
INC HL
DEC C
JR NZ,X2E09H
POP AF
RET NC
OR A
LD C,02H
JR X2E08H
END:
There are plenty of these kind of pairs, here are few of them:
PIPE, SIZE
PUSH, SWEET
TAX, WAR
same, page
WHIP, peace
person, where
I used word list, that contains only 850 basic english words in uppercase and lowercase, but you propably can find plenty of more funny pairs.
Maybe next competition could be, who finds most fun MSX password pair.
|
|
[D-Tail]
 msx guru Posts: 3020 | Posted: September 22 2004, 08:43   |
Dammit... I'm now spamming an online English dictionary with connections
I did it in a similar way as Manuel, but then instead of compare them with words in an existing list, I tried to figure wether a specific word exists using this URL. Well, 2bad Manuel got the word in the first place... after 83 minutes my script found this list:
aares
abhor
aldol
allen
amati
anted
areas
asian
badly
bairn
baldy
and well, brain wasn't just there after 83 minutes :| |
|
manuel msx guru Posts: 3545 | Posted: September 22 2004, 10:14   |
Actually, I could have done it much faster... Writing the script took only about 5 minutes, running everything took less than 10 seconds. If you like I can send you the full list of words (64), but I haven't checked for all words if they would be accepted. I stopped when I found 'brain'. It's possible that more would 'fit', but maybe someone who understands the above ML program can check whether there's more of those 64 that would do the trick. (Or check by hand  |
|
NYYRIKKI msx master Posts: 1528 | Posted: September 22 2004, 10:34   |
Manuel, I can help you to check rest of the words. Here is program, that goes trough your list:
10 defint a-z
20 bload"passwd.bin",r ´ Program from previous post
30 a=usr("produce")
40 open "list64.txt" for input as #1
50 if eof(1) then end
60 lineinput #1,a$
70 if a=usr(a$) then print a$
80 goto 50
|
|
yakumo msx user Posts: 51 | Posted: September 22 2004, 16:08   |
Is SUPER-X a disassembler? If so, where can I find it?
Thanks in advance.
BTW, is there any good Z80 disassembler? I used Fudeba's one, but I think it should have more options...
|
|
NYYRIKKI msx master Posts: 1528 | Posted: September 22 2004, 20:25   |
Well... SUPER-X is not actually disassembler, but disassembler is one of the features, that this program has. It also tells you where your SUB-ROM is, it can do the searching and traceing of the code, that I mentioned. etc.
I always want to remind people about this program, as it is simply the best tool for MSX ever made, if you are interested about ML.
SUPER-X is everything from Kanji reader to character editor and memory monitor to sector editor. It has features from MSX2 to MSX tR and BASIC to DOS2.
If you want it, please mail me.
|
|
manuel msx guru Posts: 3545 | Posted: September 22 2004, 21:24   |
Here's the list of candidates:
abhor
anted
areas
badly
bards
barer
bends
biddy
blued
bored
bract
brads
brain
capes
cargo
chasm
chill
clock
conic
crick
ditch
dived
doped
drabs
drape
elder
faith
fetal
fetid
flank
gales
gamer
gamin
genii
grand
hakes
haler
hazed
hired
holed
iambs
icier
jacks
karma
latch
lemma
lined
mambo
micra
mimed
mince
paces
padre
pared
pilaf
ranch
raped
robed
scabs
shake
space
waked
wedge
|
|
NYYRIKKI msx master Posts: 1528 | Posted: September 23 2004, 00:21   |
Quote:
| Here's the list of candidates:
|
Ok, you won the competition, but you really didn't use your MSX knowledge at all... Among those choices there were no other, that would meet the requirements.
I tried to run this test at home, and it took 3 seconds on Z80 to check the possibilitys. I think, you should have had that time...
|
|
|
|
|