RocketN*I*A.com > Mega Man Password Generators

Mega Man IV and Mega Man V's password systems are not for the faint of heart. NES and SNES Mega Man password systems tend to be somewhat direct, associating each dot or panel in the password grid with a particular set of items or weapons. The Mega Man IV password system has two features (Steps 4 and 6, below) that deliberately make this sort of association extremely difficult to make. The password encoding/decoding process is a series of meandering transformations that completely disregard the original meaning of the information. In order to follow along, it's necessary to know a little bit about the binary number system. Most significantly, Step 6 involves adding binary numbers.

Fortunately, Mega Man IV and Mega Man V use almost exactly the same system, so the same process can be used to generate passwords for each game.

In order to figure out this algorithm, I reverse-engineered the
password generation routines in Mega Man IV. Then I took a look at
Mega Man V's password generation routines and realized soon enough
that they were the same ones. What this means is that I'm extremely
confident that the system described here covers all the passwords
*generated* in these games, but I can't guarantee that they don't
*accept* some password other than the ones I'm describing here. So
maybe there's still an easter egg out there somewhere....

Construct a sequence of 40 bits (zeros and ones) that describes the state of the game. For each of the bits, if it represents a single item or battle, write down a 1 to have that item or to have finished that battle and a 0 otherwise. If it is an item you can have in multiples, write down a binary representation of number of that item you want to have, using zeros at the beginning to fill up any bits you don't need.

Mega Man IV: !@#$[pct]^&* m yliwtaeb EEE ee WWW S B PPPPPPPP PP LLL Mega Man V: ,.:;-=_+ d upsjMCG? EEE ee WWW S B PPPPPPPP PP LLL

!@#$%^&* | Charge Man, Stone Man, Napalm Man, Crystal Man, Ring Man, Pharaoh Man, Bright Man, and Toad Man, respectively |

,.:;-=_+ | Uranus, Pluto, Saturn, Jupiter, Neptune, Mars, Venus, and Mercury, respectively |

m | Ballade (first battle) |

d | Dark Moon |

yliwtaeb | Y, L, I, W, T, A, E, and B Plates, respectively |

upsj | Uranus's, Pluto's, Saturn's, and Jupiter's crystals, respectively |

M | MH Mega Arm upgrade |

C | CL Mega Arm upgrade |

G | Power Generator |

? | You can put anything you'd like to here, but the normal value is 0. As far as I can tell, this item, if it even is an item, is impossible to get in the game without using a password to get it, and the only effect it has is that it changes what passwords you get, since your passwords continue to keep track of it. If you find another use for this, let me know! |

EEE | Complete E-Tanks (ranging from 0 to 4) |

ee | Loose E-Tank pieces (ranging from 0 to 3 but must be 0 if there are 4 E-Tanks) |

WWW | W-Tanks (ranging from 0 to 4) |

S | S-Tank |

B | Energy Balancer |

PPPPPPPP PP | P-Chips (ranging from 0 to 999), arranged with the first two bits at the end (e.g. 258 P-Chips, 010000010 P-Chips in binary, is represented as 00000010 01) |

LLL | Extra lives, as seen on the status screen, in excess of two (ranging from 0 to 7; e.g. 5 extra lives, or 3 extra lives in excess of two, is represented by 011) |

The Mega Man IV password system is strict; if you try to create a password for a scenario that could never occur in the normal course of the game, that password will be incorrect.

The Mega Man V password system is somewhat more lenient. As long as a valid combination of Dark Moon and the eight Stardroids are defeated, and as long as you don't have too many E-Tanks, E-Tank parts, W-Tanks, or P-Chips, the password is valid. Although under normal circumstances you would only be able to get the crystals when you had access to the last four stages and you would only be able to get the Power Generator once you had all four crystals, none of that matters to the validity of your passwords. Feel free to have the Power Generator at the beginning of the game!

Certain items aren't shown above, either because you get them by having other items or because the passwords just don't keep track of them. Here's a list of those items and how to get them:

Let's generate the "ultimate" passwords for Mega Man IV and Mega Man V, passwords that give us as many weapons, plates, items, and lives as we can carry. This is the type of password that tends to be posted to cheat sites and incorporated into FAQs.

We can create ultimate passwords for both games simultaneously if we use the following sequence:

11111111 1 11111111 100 00 100 1 1 11100111 11 111

If we use this sequence for Mega Man V, we are giving ourselves an extra item that doesn't do anything and that we could never have obtained normally. (Don't bother looking for it; it doesn't appear on the status screen.) If we wanted to get a "normal" ultimate password for Mega Man V, we would need to use the following sequence instead:

11111111 1 11111110 100 00 100 1 1 11100111 11 111

For simplicity's sake, we'll just keep going with the first sequence rather than choosing a separate one for each game.

Let's separate the sequence into bytes (so that every 8 bits is grouped together):

11111111 11111111 11000010 01111100 11111111

Besides helping chunk the sequence up into neat slices, this will be a bit of a help in Steps 3 and 6.

For each bit indicated by `*`

, change it from a 0 to a 1 or vice
versa:

-*-**--* -*-*-*-- -*-**--- --*---** ----*---

Our sequence undergoes the following transformation:

before: 11111111 11111111 11000010 01111100 11111111 change: -*-**--* -*-*-*-- -*-**--- --*---** ----*--- after: 10100110 10101011 10011010 01011111 11110111

Calculate two values as follows:

To get the first value, count the number of ones in the sequence, find the remainder when dividing that number by 8, and represent that remainder as a three-bit binary number. We'll call this value the three-bit checksum.

To get the second value, interpret every four bits of the sequence as a binary number, add up all of those numbers, find the remainder when dividing the total by 32, and represent that remainder as a five-bit binary number. We'll call this value the five-bit checksum.

(Finding the remainder when dividing a number by 8 is the same as looking at just the last three bits of that number's binary representation, and finding the remainder when dividing by 32 is the same as looking at just the last five bits, so we can take remainders or crop off bits interchangeably in each of the above processes without it making a difference.)

We have 26 ones in our sequence. Since the remainder when dividing 26 by 8 is 2, our three-bit checksum is 010.

To get our five-bit checksum, we first add up the binary values represented by every four bits in our sequence:

1010 = 10 0110 = 6 1010 = 10 1011 = 11 1001 = 9 1010 = 10 0101 = 5 1111 = 15 1111 = 15 + 0111 = 7 ------- -- 1100010 = 98

The last five bits of the sum, 00010 (2 in decimal), give us our five-bit checksum.

Rotate the sequence to the right by a number of bits equal to the five-bit checksum.

Our five-bit checksum is 2, so we slide each bit in the sequence 2 spaces to the right and move the 2 bits that "fall off" back to the beginning:

10100110101010111001101001011111111101 11 11 10100110101010111001101001011111111101

Let's organize this sequence into bytes again:

11101001 10101010 11100110 10010111 11111101

Put the three-bit checksum and the five-bit checksum onto the end of the sequence in that order.

Since our checksums are 010 and 00010, our sequence is now as follows:

11101001 10101010 11100110 10010111 11111101 01000010

Modify the sequence by summing each byte with its respective byte from the following sequence, performing the addition in binary:

00010010 00110100 01010110 01111000 10011010 10111100

(As a side note, this sequence is `123456789ABC`

in hexadecimal.)

Whenever one of these sums has nine bits, crop the leftmost bit off so that the sum fits back into the sequence. (This is the same as taking the remainder when dividing the sum by 256.)

We calculate the following sums:

11101001 10101010 11100110 10010111 11111101 01000010 + 00010010 + 00110100 + 01010110 + 01111000 + 10011010 + 10111100 ---------- ---------- ---------- ---------- ---------- ---------- 11111011 11011110 100111100 100001111 110010111 11111110

The third, fourth, and fifth sums each have nine bits, so we crop those down to size by removing their leading ones. Putting the cropped sums back together yields the following sequence:

11111011 11011110 00111100 00001111 10010111 11111110

Replace every two bits in the sequence with a corresponding symbol, as follows:

`00`

`->`

`R`

`01`

`->`

`E`

`10`

`->`

`B`

or`T`

for Mega Man IV or Mega Man V, respectively`11`

`->`

`-`

(a blank space)

Our sequence transforms as follows:

11111011 11011110 00111100 00001111 10010111 11111110 Mega Man IV: - - B - - E - B R - - R R R - - B E B - - - - B Mega Man V: - - T - - E - T R - - R R R - - T E T - - - - T

For Mega Man V, add a symbol (`R`

, `E`

, `T`

, or
`-`

) to the end of the sequence. It doesn't matter which one.

Note that all passwords the game gives you during play will use
`R`

here. Entering a password that doesn't use `R`

won't
change that.

Instead of using the `R`

that the game defaults to, let's use
`-`

so that our resulting password is easier to type. Now our
sequence for Mega Man V is as follows:

--T--E-TR--RRR--TET----T-

Put the symbols in the sequence into the password grid one at a time, going first from top to bottom and then from left to right as the columns fill up. The password is now complete.

Here's the ultimate password we have made for Mega Man IV:

--RRB- -E-RE- B---B- -BR--B

Here's the one for Mega Man V (which, as mentioned above, is different from the one obtained through actual play):

-E--- --RT- TTRE- -RRTT -----

Mega Man IV, Mega Man V, and their password systems are the property of Capcom. Special thanks to all password crackers for inspiring me to do this kind of thing, and especially special thanks to Mandi Paugh, whose website (www.mmhp.net) hosts a slightly-incomplete collection of Mega Man password cracks that's just itching to be rounded off.

- Pages
- Programming Techniques
- Web Programming Sandbox
- Mega Man Password Generators
- Base-Changing Calculator
- Miscellaneous Old Works
- Resume

- My Sites

© 2005–2010 Ross Angle (rocketnia)

This page was last updated 3-Oct-2010.