Skip to content

Instantly share code, notes, and snippets.

@erichelgeson
Created April 18, 2022 15:24
Show Gist options
  • Save erichelgeson/29800be7cf353f0a8af00709223c87bc to your computer and use it in GitHub Desktop.
Save erichelgeson/29800be7cf353f0a8af00709223c87bc to your computer and use it in GitHub Desktop.

Assumes you're on a Mac or know what you're doing.

Extract driver, assumes location

$ dd if=HD0-someimage.hda of=./driver.img skip=64 count=32 bs=512

Calculate hash

$ md5 driver.img
MD5 (driver.img) = d0d8c3c75272318f52d2959bd89b995f

Compare to known drivers:

MD5 (Apple-Drive-Setup-1.7.3.img) = d0d8c3c75272318f52d2959bd89b995f
MD5 (Apple-Drive-Setup-2.0.3.img) = 65d733852e43d0069ce047303aa8da4e
MD5 (Apple-HD-SC-Setup-7.3.5.img) = 091d091ac0142ee8fe2c5a8804f1b64d
MD5 (FWB-4.5.2.img) = ce338fe6899778aacfc28414f2d9498b
MD5 (Lido-7.56.img) = e9744928bb5740e6319c46ec1f411258
MD5 (MacOS8-Installer-Driver.img) = 0db042c0a77c40ae3e541aa967e521ba
@codebutler
Copy link

codebutler commented Apr 20, 2022

Thanks, super useful. Quick python script to do the same:

from pathlib import Path
import hashlib
import sys

BLOCK_SIZE = 512

KNOWN_DRIVERS = {
    "d0d8c3c75272318f52d2959bd89b995f": "Apple-Drive-Setup-1.7.3.img",
    "65d733852e43d0069ce047303aa8da4e": "Apple-Drive-Setup-2.0.3.img",
    "091d091ac0142ee8fe2c5a8804f1b64d": "Apple-HD-SC-Setup-7.3.5.img",
    "ce338fe6899778aacfc28414f2d9498b": "FWB-4.5.2.img",
    "e9744928bb5740e6319c46ec1f411258": "Lido-7.56.img",
    "0db042c0a77c40ae3e541aa967e521ba": "MacOS8-Installer-Driver.img",
}

for n in sys.argv[1:]:
    with Path(n).open(mode="rb") as f:
        f.seek(64 * BLOCK_SIZE)
        h = hashlib.md5(f.read(32 * BLOCK_SIZE)).hexdigest()
        print(f"{n:<30} {h} {KNOWN_DRIVERS.get(h, 'UNKNOWN')}")

@erichelgeson
Copy link
Author

Very nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment