Herzog Zwei is a game made by Technosoft back in 1989 for the Genesis and Mega Drive game systems. The game can be completed by playing as either the red player or blue player. Either campaign consists of 8 levels played at 4 difficulty settings making a total of 32 different scenerios to complete the game. There is no battery in the cartridge so in order for the game to 'remember' where you last left off, a password is provided to the player at the end of each level. When the player wants to pick up where they last left off, they enter the password and the scenerios they have played already finished are greyed out, allowing them to pick up where they last left off. This document shows how the password is generated and, very interestingly, shows the hidden message that was programmed into the password cipher. So, let's get started!
First, on the password entry screen, one will notice that the only characters they are given are the letters A through P. That makes for exactly 16 different characters. If you substitute A for 0, B for 1, C for 2 and so on, you will find that you can easily substitute all of these characters for those of the hexadecimal numbering system. Specifically instead of using:
... you can now use:
... to illustrate the same set of characters using a standard well-accepted system of digits:
This is important because it makes it easier to encode each of these characters into binary by simply using one nibble (four binary digits) to express each character uniquely (and assign it an individual weight to calculate the checksum - more on that later)... specifically:
So, for a password such as:
Each character can be expressed in decimal as:
Here it is in HEX:
And, finally, here it is in Binary (stay with me!):
The first two characters in this password example, "CP", show all of the 8 levels that were beaten at the "A" (easiest) difficulty. The second pair of characters "GH" show the beaten "B" levels. The third and fourth pair of characters *just so happen* to be identical, "CA", and show the "C" and "D" levels beaten.
Here's how it works; I'll re-arrange the first 8 characters of the password top-down like this:
|2nd 4 Levels:||C||G||C||C|
|1st 4 Levels:||P||H||A||A|
Notice that the levels are listed in reverse order from what you'd be used to seeing at the in-game selection screen:
Converting the password arranged in this way into binary:
|2nd 4 Levels:|
|1st 4 Levels:|
"X" indicates beaten levels (in this case, only Waldung:difficulty "A" was beaten):
If any of the bits are toggled from 1 to 0 or 0 to 1, then they will be set to the opposite of whether that level was beaten or not. So, in other words, if I want a password that has all the levels beaten EXCEPT Waldung, like this:
... then the binary mask should look like this (all 1's are inverted to 0's and all 0's are inverted to 1's):
|2nd 4 Levels:|
|1st 4 Levels:|
Which, illustrated top-down in the password characters, should look like this:
|2nd 4 Levels:||N||J||N||N|
|1st 4 Levels:||A||I||P||P|
Laid out straight, it looks like this:
To complete this password, we need three more characters which we will cover now:
So, let's take a look at these three characters "CKH" at the end of the password and see what information they contain, shall we? The first of these last three characters is "C". This character can be broken up into its binary parts:
The first three digits of this binary nibble (001) show us the 'chosen' cipher. In this case, it is the 2nd of a total of 8 available ciphers! The last digit of this binary nibble (0) shows whether or not the password shows the status of the red player or blue player. In this case, it is the red player. If it were the blue character, it would have been a (1), changing the password character from a "C"(0010) to a "D"(0011).
Finally, the last two characters are the checksum and they are the sole reason you cannot simply enter a bunch of random characters in the password entry screen and expect it to work. All the characters prior to these last two characters must add up to the value contained in these last two characters. BUT - it's not quite that simple! Each of their binary values are actually inverted so you have to go through one extra step to get the right characters. At least it's an easy step:
So, to calculate the two checksum characters in our loyal example above,
We will need to take the sum of the decimal values of the first 9 characters:
2+15+6+7+2+0+2+0+2 = 36
And now to come up with the last two characters, find out how many times 36 can be divided by 16 (the answer is twice, with a remainder of 4)... so write down the corresponding characters that associate to the decimal values of 2 (for twice) and 4 (for the remainder):
Now, go and change them to nibbles:
And invert them (change 1's to 0's and 0's to 1's):
Now, change the inverted nibbles back to our password characters:
So the entire password, in all it's glory, including valid checksum characters is:
That wasn't too hard, was it?
Now, we're getting close to the truly fascinating part!! Remember how I said there were 8 ciphers? You never know which one will get 'chosen' and it is the reason why you may find that resetting the game and then beating Waldung again may yield a different password such as:
Which is an equivalent password to our example: CPGHCACACNL. Entering either one will yield the same result. As you may have guessed, the 9th character in MIGFHCHKAMG, "A" implies that the 1st of 8 ciphers was used to generate this password (for the red player as the blue player character would have been "B" instead of "A")... here, let's just put all those ciphers in one place (in the form of password characters and in order):
|000||EIGFHCHK||(A or B)|
|001||GPGHCACA||(C or D)|
|010||FKHHGFGJ||(E or F)|
|011||CAGIGBCA||(G or H)|
|100||EHEBEOCA||(I or J)|
|101||GDGIGBGO||(K or L)|
|110||HDGBGLHF||(M or N)|
|111||GEGBHJGP||(O or P)|
Looks like a mess, doesn't it? If we convert these to their HEX equivalents, here's the result (again, stay with me, because at the end, I'm gonna blow your mind!!):
|000||48 65 72 7A|
|001||6F 67 20 20|
|010||51 77 65 69|
|011||20 68 61 20|
|100||47 41 4E 20|
|101||63 68 61 6E|
|110||73 61 6B 61|
|111||64 61 79 6F|
Now, look up your old trusty ASCII chart and you will find that each one of the bytes (pairs of nibbles) translate into the following:
|000||H e r z|
|001||o g _ _|
|010||Z w e i|
|011||_ h a _|
|100||G A N _|
|101||c h a n|
|110||s a k a|
|111||d a y o|
And lay it out straight, it reads:
"Herzog Zwei ha GAN chan sakadayo"
Here it is in Japanese katakana/hiragana/kanji:
Which, translated from Japanese, means:
"Herzog Zwei is the work of Gan-chan"
Who is Gan-chan, you ask? Well, the programmer's family name is Iwanaga . If you take the Japanese character for the "Iwa" part of his name and couple it with another character that means "rock", it changes the pronunciation of that "Iwa" character to "Gan", to make the word "Ganseki" (stone). Hence, Takeshi Iwanaga's nick name must have been "Gan-chan".
Is that cool or what?
OK, it took me almost an entire month to figure all of this out, so please be nice and download my silly Herzog Zwei Password app on the iTunes store today!! If you still play this awesome game, you'll find the app very handy (and fund my daughter's college tuition at the same time by contributing [my share of] the $.99!).
Thanks for sharing this moment of discovery with me. :)
PS - Special thanks to Gye and Nori for help with the Japanese translation!