Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.


From Data Crystal
Jump to navigation Jump to search


What Is A Hash?

Among other purposes, hashes are used to confirm two copies of a file are identical. Hashes are important when dealing with ROM hacks and translations, because they help ensure a patch is being applied to the correct file. Without this safeguard, it's possible to patch the wrong version of a ROM, causing problems that can be anywhere from subtle glitches to a completely non-functional ROM.

A hash is a "digest", or a number that is calculated from the contents of a file. A hash is usually shown as a long hexadecimal number, something like this: 26D9D83443447D3163549114C0BD43B288DFF3FF. If two files produce the same hash, it generally means the files are exactly the same. Even the tiniest change in a file will produce a completely different hash.

There are many different hash algorithms. For example SHA-1, MD5, and CRC32 each use a different formula for producing hashes.

What Types Of Hashes Are There?

There are tons of different hash algorithms out there, but only a small number are relevant to ROMs and ROM hacking. Historically, CRC32 has been widely used, but better alternatives are available. MD5 is an all-around popular hash algorithm, but it's usage is rapidly declining due to the fact that it is cryptographically compromised. It is still adequate for verifying ROM images. SHA-1 is probably the best candidate for verifying ROM images. SHA-256 is another reliable hash, but it is not as widely used as SHA-1.


With regards to hashes, the term "collision" refers to two different files that produce the same hash value. With some hash algorithms, such as MD5, techniques have been discovered to intentionally create collisions. This represents a significant concern when hashes are being used in a security context, but is not an issue when simply verifying files such as ROM images. The chances of a coincidental, accidental collision are exceedingly small.

Using Hashes

ROM Hash Vs. File Hash

For many systems, such as NES, SNES, and Genesis, a ROM file may include extra data in addition to the actual ROM image. A file hash refers to a hash calculated using the contents of the entire file. A ROM hash refers to a hash calculated using only the ROM image and ignoring any extra data such as extra headers. It's important to know whether you're dealing with ROM hashes or file hashes, since they may produce different values.

It can be useful to have both types of hashes available. If two files produce the same ROM hash but produce different file hashes, this indicates the ROM images are identical, but there is a difference between the extra data included in the files, most likely a difference between the two file's headers. Depending on the exact circumstances, it may be possible to correct the differences with a utility or, sometimes (such as with .NES files when using IPS patches), header differences may be safely ignored.

Verifying ROM Images

So you want to play a hack or translation. Better make sure you're patching the right ROM, or things are gonna go wrong. You can verify you have the correct ROM image by calculating hashes for your copy of the ROM and comparing them to those listed by the author of a hack. Be sure you know what type of hash you're working with (MD5, SHA-1, etc.), whether the author is providing ROM or file hashes, and whether the hashes listed apply to the original ROM image, or the patched ROM image. There is a list of tools that can be used to calculate hashes at the end of the page.

Producing Hashes For Others

So you've finished a hack or translation and want to share it with the world. How do you ensure they're applying your patch to the correct file? Give them good, quality hashes. Know exactly what kind of hashes your utility of choice provides and be sure to share this info with others. Explicitly state the following:

  • Whether the hash is for the ROM image or entire file
  • The algorithm(s) used
  • Whether the hashes provided are intended to verify the original ROM (before patching) or the hacked ROM (after patching).

Without clear, accurate information, confusion will ensue!

Hashing Utilities

  • Hash Tab
    • Produces file hashes
    • Supports MD5, SHA-1, SHA-256, and others
  • ROM Hasher
    • Produces ROM and file hashes
    • Supports CRC32, MD5, SHA-1, SHA-256
    • Access hashes via Help->MessageLog
    • Produces ROM hashes
    • Supports CRC32 and MD5
    • NES only
  • SNES9X
    • Produces ROM hashes
    • Supports CRC32
    • SNES only
  • FileFormat.Info
    • Produces file hashes
    • Supports CRC32, MD5, SHA-1, SHA-256 and others