I started working out the routines to decode/encode Legacy of the Wizard passwords, but decided to quit when I realized I'd need to have treasure chest location specifics.
I'm posting it in case someone else feels some interest in the info.
---
Confirmed:
00-1F:
PassTable = "AHOU1BIPV2CJQW3DKRX4ELSY5FMTZ6GN"
A-Z
1-6
Gamefaqs: Start new game with All Equipment & Items(11)/Max.Keys/Max.Gold:
LBJM NPDV 4OG6 LLLN
3PG5 W5KT D5RL SNKY
Decodes to:
0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F (Treasure Chests Opened. Can be left in this form)
0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B (Item List. Can be left in this form. 0x0B/11 is the normal max. for each)
---
Likely working as-is:
Dim PassDecode(0 to 31) as Byte
Dim PasswordXor as Long
Dim ChecksumCheckA as Integer
Dim ChecksumCheckB as Integer
Dim ChecksumCalcA as Integer
Dim ChecksumCalcB as Integer
Dim PassKeys as Integer
Dim PassGold as Integer
Private Function DoPasswordIntegerAddition(InputValue as Long, InputTest as Byte) as Long
Do
DoPasswordIntegerAddition = InputValue * 3
DoPasswordIntegerAddition = DoPasswordIntegerAddition + 1
DoPasswordIntegerAddition = DoPasswordIntegerAddition + (((InputValue AND 255) * 256) AND 32767)
Loop While ((InputValue AND 65280) / 256) > InputTest
End Function
---
Written out pseudo-near-vb6-code, was to be polished/confirmed later:
'Init the root value
PasswordXor = PassDecode(15) + (PassDecode(31) * 256)
For I = 14 to 0 Step -1
PasswordXor = DoPasswordIntegerAddition(PasswordXor,32)
PassDecode(I) = PassDecode(I) Xor ((PasswordXor AND 65280) / 256)
PasswordXor = DoPasswordIntegerAddition(PasswordXor,32)
PassDecode(I + 16) = PassDecode(I + 16) Xor ((PasswordXor AND 65280) / 256)
Next I
ChecksumCheckA = PassDecode(16)
'Calc Checksum Part + Convert Entries
For I = 30 to 16 Step -2
ChecksumCheckA = (Int((ChecksumCheckA OR 4096) / 2) + ((PassDecode(I) AND 1) * 128)) AND 255
PassDecode(I) = (PassDecode(I) AND 254) / 2
Next I
ChecksumCheckB = ChecksumCheckA
For I = 14 to 0 Step -2
ChecksumCheckB = (Int((ChecksumCheckB OR 4096) / 2) + ((PassDecode(I) AND 1) * 128)) AND 255
PassDecode(I) = (PassDecode(I) AND 254) / 2
Next I
ChecksumCalcA = 0
For I = 31 to 0 Step -1
ChecksumCalcA = ChecksumCalcA + PassDecode(I)
Next I
If (ChecksumCheckA AND 255) <> (ChecksumCalcA AND 255) then
'Failed Checksum 1
Endif
ChecksumCalcB = 10
For I = 31 to 0 Step -1
ChecksumCalcB = ChecksumCalcB Xor PassDecode(I)
Next I
If (ChecksumCheckB AND 255) <> (ChecksumCalcB AND 255) then
'Failed Checksum 2
Endif
PassKeys = ChecksumCheckB
'Calc Checksum Part + Convert Entries
For I = 31 to 17 Step -2
PassKeys = (Int((PassKeys OR 4096) / 2) + ((PassDecode(I) AND 1) * 128)) AND 255
PassDecode(I) = (PassDecode(I) AND 254) / 2
Next I
PassGold = PassKeys
For I = 15 to 1 Step -2
PassGold = (Int((PassGold OR 4096) / 2) + ((PassDecode(I) AND 1) * 128)) AND 255
PassDecode(I) = (PassDecode(I) AND 254) / 2
Next I
'The rest just combines the 0F 0F 0F... row of data into FF FF FF ... data by shifting and ORing bits, and otherwise moving data to other spots. I was intending to leave the rest of the data as it is, because it's just 00-0B for items, and 00-0F for some treasure collection bytes. Easier to assemble/disassemble if not converted.
---
I'm posting it in case someone else feels some interest in the info.
---
Confirmed:
00-1F:
PassTable = "AHOU1BIPV2CJQW3DKRX4ELSY5FMTZ6GN"
A-Z
1-6
Gamefaqs: Start new game with All Equipment & Items(11)/Max.Keys/Max.Gold:
LBJM NPDV 4OG6 LLLN
3PG5 W5KT D5RL SNKY
Decodes to:
0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F (Treasure Chests Opened. Can be left in this form)
0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B (Item List. Can be left in this form. 0x0B/11 is the normal max. for each)
---
Likely working as-is:
Dim PassDecode(0 to 31) as Byte
Dim PasswordXor as Long
Dim ChecksumCheckA as Integer
Dim ChecksumCheckB as Integer
Dim ChecksumCalcA as Integer
Dim ChecksumCalcB as Integer
Dim PassKeys as Integer
Dim PassGold as Integer
Private Function DoPasswordIntegerAddition(InputValue as Long, InputTest as Byte) as Long
Do
DoPasswordIntegerAddition = InputValue * 3
DoPasswordIntegerAddition = DoPasswordIntegerAddition + 1
DoPasswordIntegerAddition = DoPasswordIntegerAddition + (((InputValue AND 255) * 256) AND 32767)
Loop While ((InputValue AND 65280) / 256) > InputTest
End Function
---
Written out pseudo-near-vb6-code, was to be polished/confirmed later:
'Init the root value
PasswordXor = PassDecode(15) + (PassDecode(31) * 256)
For I = 14 to 0 Step -1
PasswordXor = DoPasswordIntegerAddition(PasswordXor,32)
PassDecode(I) = PassDecode(I) Xor ((PasswordXor AND 65280) / 256)
PasswordXor = DoPasswordIntegerAddition(PasswordXor,32)
PassDecode(I + 16) = PassDecode(I + 16) Xor ((PasswordXor AND 65280) / 256)
Next I
ChecksumCheckA = PassDecode(16)
'Calc Checksum Part + Convert Entries
For I = 30 to 16 Step -2
ChecksumCheckA = (Int((ChecksumCheckA OR 4096) / 2) + ((PassDecode(I) AND 1) * 128)) AND 255
PassDecode(I) = (PassDecode(I) AND 254) / 2
Next I
ChecksumCheckB = ChecksumCheckA
For I = 14 to 0 Step -2
ChecksumCheckB = (Int((ChecksumCheckB OR 4096) / 2) + ((PassDecode(I) AND 1) * 128)) AND 255
PassDecode(I) = (PassDecode(I) AND 254) / 2
Next I
ChecksumCalcA = 0
For I = 31 to 0 Step -1
ChecksumCalcA = ChecksumCalcA + PassDecode(I)
Next I
If (ChecksumCheckA AND 255) <> (ChecksumCalcA AND 255) then
'Failed Checksum 1
Endif
ChecksumCalcB = 10
For I = 31 to 0 Step -1
ChecksumCalcB = ChecksumCalcB Xor PassDecode(I)
Next I
If (ChecksumCheckB AND 255) <> (ChecksumCalcB AND 255) then
'Failed Checksum 2
Endif
PassKeys = ChecksumCheckB
'Calc Checksum Part + Convert Entries
For I = 31 to 17 Step -2
PassKeys = (Int((PassKeys OR 4096) / 2) + ((PassDecode(I) AND 1) * 128)) AND 255
PassDecode(I) = (PassDecode(I) AND 254) / 2
Next I
PassGold = PassKeys
For I = 15 to 1 Step -2
PassGold = (Int((PassGold OR 4096) / 2) + ((PassDecode(I) AND 1) * 128)) AND 255
PassDecode(I) = (PassDecode(I) AND 254) / 2
Next I
'The rest just combines the 0F 0F 0F... row of data into FF FF FF ... data by shifting and ORing bits, and otherwise moving data to other spots. I was intending to leave the rest of the data as it is, because it's just 00-0B for items, and 00-0F for some treasure collection bytes. Easier to assemble/disassemble if not converted.
---