How the passwords are built
Pandemonium has four password schemes. All of them encode the same information. This generator generates passwords of the fourth scheme. There are four presumably to make it harder to see exactly what changes in the passwords when you get them, thus making them harder to crack.
They all use the same translation from characters to bits. Only the characters A-P are allowed. This is 16 possible characters, and each password contains 8 characters. This gives 32 bits per password. Each character encodes 4 bits of information.
The passwords contain 21 bits of information, 7 bits of checksum, 2 bits to determine which scheme it is, and two bits which are locked (set to 0 in scheme 4).
What follows is the description of how the scheme works. It's based on a dataset of 54 passwords from the game.
Checksum
7 bits. It is the sum of character + weapon + lives + extra hearts + level + heart containers + 3
Bit positions, from MSB to LSB:
30, 31, 2, 3, 4, 5, 6
Character
1 bit. Encoded in position 13. 0
for Nikki, 1
for Fargus
Weapon
2 bits. Encoded in positions 14 and 15.
- None
00
(0)- Fire
01
(1)- Ice
10
(2)- Shrink
11
(3)
Level
Levels are 0-indexed, i.e. what the game considers Level 1 is coded as 0.
5-digit binary number rotated so that LSB comes right before MSB, otherwise in order. Encoded in bits, from MSB to LSB:
25, 26, 27, 28, 24
Note: The rotation is applied before adding to the checksum
Lives
5-digit binary number rotated so that LSB comes right before MSB, otherwise in order. Encoded in bits, from MSB to LSB:
20, 21, 22, 23, 19
Note: The rotation is applied before adding to the checksum
Interesting fact: The game will not generate passwords with less than 2 lives
Number of hearts
3-bit binary number rotated so that MSB comes to the left, after LSB, otherwise in order. Encoded in bits, from MSB to LSB:
18, 16, 17
Note: The rotation is applied before adding to the checksum
The game gives you this many hearts plus one. In a new game it's set to 1, but you have 2 hearts. If you set it to 0, you will have 1 heart in the game.
Note that which heart containers you have and how many hearts you have are not related at all in the password. You can have 7 extra hearts and no picked up heart containers.
Heart containers
Each container sets its respective bit to 1, and adds its weight to the checksum.
- Level 3
- Bit 8, weight 16
- Level 5
- Bit 12, weight 1
- Level 10
- Bit 10, weight 4
- Level 13
- Bit 11, weight 2
- Level 16
- Bit 9, weight 8
Encoded in bits:
8, 9, 10, 11, 12
Note that which heart containers you have and how many hearts you have are not related at all in the password. You can have 7 extra hearts and no picked up heart containers.
Password scheme number
2 bits. Encoded in bits:
0, 1
This is scheme 4, so they are always 11
Unknown bits
The bits in position 7 and 29 are always 0. Experiments by setting them to 1 and modifying the checksum has yielded no valid passwords. They are assumed to be some kind of markers.