Doom cheat code encryption
Dan Tobias (Talk | contribs) |
m |
||
(7 intermediate revisions by one user not shown) | |||
Line 4: | Line 4: | ||
|released=1993 | |released=1993 | ||
}} | }} | ||
− | '''Doom cheat code encryption''' was used in the original 1993 version of Doom to make the cheat codes a little harder for hackers to find, so they didn't appear in the raw binary code as plain [[ASCII]] characters. Twitter user [https://twitter.com/Foone @Foone] described it in a 2019 thread. | + | '''Doom cheat code encryption''' was used in the original 1993 version of Doom to make the cheat codes a little harder for hackers to find, so they didn't appear in the raw binary code as plain [[ASCII]] characters. (Of course, the hackers found them anyway.) Twitter user [https://twitter.com/Foone @Foone] described it in a 2019 thread. |
This low-grade encryption is done by shifting the bits of 8-bit numbers (which can represent single ASCII characters) which reverses the order of the bits except for those representing 4 and 32. The shifted values are stored in a lookup table in the Doom program. | This low-grade encryption is done by shifting the bits of 8-bit numbers (which can represent single ASCII characters) which reverses the order of the bits except for those representing 4 and 32. The shifted values are stored in a lookup table in the Doom program. | ||
+ | |||
+ | == Details == | ||
+ | |||
+ | As described by @Foone, who has [https://twitter.com/Foone/status/1190656026342637569 allowed these descriptions to be released as CC0] so they can be used here: | ||
+ | |||
+ | :So Doom (1993) has a neat bit of encryption in it. It's not very strong encryption, but it's still encryption. | ||
+ | :And it's not used in any sort of way you'd normally expect: not copy protection, or multiplayer anti-cheat, or anti-tampering on saves... It's to slow down FAQs. | ||
+ | |||
+ | :So here's the code I'm talking about, the macro SCRAMBLE | ||
+ | :It looks annoyingly complicated but it's not, really. | ||
+ | :It's taking an 8-bit number and shifting around some of the bits. | ||
+ | |||
+ | :[[File:Doom-cheat-code-encryption-01.png]] | ||
+ | |||
+ | :If you diagram out what's happening, it makes slightly (BUT ONLY SLIGHTLY) more sense. | ||
+ | :It kinda looks like they started with a a "reverse the order of these bits" function but then switched it so the 4 and 32 don't get switched, they just go straight through. | ||
+ | |||
+ | :[[File:Doom-cheat-code-encryption-02.jpg]] | ||
+ | |||
+ | :So, how is this code used? | ||
+ | :Well, in m_cheat.c, it's used to build a lookup table which has all the values pre-encrypted, so it can quickly look them up later. Then, when you press a key, it translates it through this table: | ||
+ | |||
+ | :[[File:Doom-cheat-code-encryption-03.png]] | ||
+ | |||
+ | The thread goes on with more discussion of how these codes were used and discovered. It's worthwhile reading for people into this sort of trivia. | ||
== Links == | == Links == | ||
Line 13: | Line 38: | ||
[[Category:Game data files]] | [[Category:Game data files]] | ||
[[Category:id Software]] | [[Category:id Software]] | ||
+ | [[Category:DOOM (Game)]] |
Latest revision as of 11:46, 13 January 2023
Doom cheat code encryption was used in the original 1993 version of Doom to make the cheat codes a little harder for hackers to find, so they didn't appear in the raw binary code as plain ASCII characters. (Of course, the hackers found them anyway.) Twitter user @Foone described it in a 2019 thread.
This low-grade encryption is done by shifting the bits of 8-bit numbers (which can represent single ASCII characters) which reverses the order of the bits except for those representing 4 and 32. The shifted values are stored in a lookup table in the Doom program.
[edit] Details
As described by @Foone, who has allowed these descriptions to be released as CC0 so they can be used here:
- So Doom (1993) has a neat bit of encryption in it. It's not very strong encryption, but it's still encryption.
- And it's not used in any sort of way you'd normally expect: not copy protection, or multiplayer anti-cheat, or anti-tampering on saves... It's to slow down FAQs.
- So here's the code I'm talking about, the macro SCRAMBLE
- It looks annoyingly complicated but it's not, really.
- It's taking an 8-bit number and shifting around some of the bits.
- If you diagram out what's happening, it makes slightly (BUT ONLY SLIGHTLY) more sense.
- It kinda looks like they started with a a "reverse the order of these bits" function but then switched it so the 4 and 32 don't get switched, they just go straight through.
- So, how is this code used?
- Well, in m_cheat.c, it's used to build a lookup table which has all the values pre-encrypted, so it can quickly look them up later. Then, when you press a key, it translates it through this table:
The thread goes on with more discussion of how these codes were used and discovered. It's worthwhile reading for people into this sort of trivia.