cpw83
Posts: 5
Joined: Tue Jul 03, 2018 6:37 pm

Confused about softwarelist CHD SHA1s

Hi,

I'm somewhat confused about the SHA1 checksums of softwarelist CHDs, they don't seem to match, respectively I don't seem to be able to generate a CHD with a matching SHA1 from a CD image.

For example let's take a look at https://raw.githubusercontent.com/mamed ... segacd.xml

Code: Select all

<software name="roadaven">
    <!-- Source: redump.org - http://redump.org/disc/29313/
    <rom name="Road Avenger (USA).cue" size="453" crc="9e7d5e08" md5="840ebb398cce8d27cf3a5d253d8b575d" sha1="cd2b55540b911786886f43aae99e228d9f85efc5"/>
    <rom name="Road Avenger (USA) (Track 1).bin" size="317816352" crc="cf3bd177" md5="71e1578e091e0d5df4b07f4f26e4d2c9" sha1="9cf7095ab8f7a5aa5df046d0b665263f4f506f19"/>
    <rom name="Road Avenger (USA) (Track 2).bin" size="2664816" crc="5ef6a4c1" md5="3c3aab85aca0bf19bf2dd24d98f4e0e2" sha1="13ff4a9ceaf86c8eaa2e9545debf93795f83178e"/>
    <rom name="Road Avenger (USA) (Track 3).bin" size="2065056" crc="3234951b" md5="403fb20b63be8f4ca9e94efdc6ed5a20" sha1="cfbf3ec5d558150cea39be7ad4644da7b7e47680"/>
    <rom name="Road Avenger (USA) (Track 4).bin" size="13707456" crc="60656878" md5="1fb43c548570fbd61016ed3d7730e8c4" sha1="e350748a37d80e93ad74132b78ec9cd96e44acb4"/>
    -->
    <description>Road Avenger (USA)</description>
    <year>1993</year>
    <publisher>Renovation</publisher>
    <info name="serial" value="T-6207"/>
    <info name="release" value="199303xx" />
    <info name="ring_code" value="SEGA6207 R1D MFD BY JVC"/>
    <part name="cdrom" interface="scd_cdrom">
        <diskarea name="cdrom">
            <disk name="road avenger (usa)" sha1="05fa6ae67687aacdf99fe939b0f04ce13b6d527b"/>
        </diskarea>
    </part>
</software>
The SHA1 of the chd given here (05fa6ae67687aacdf99fe939b0f04ce13b6d527b) is the same that -listsoftware puts out. I have all four of those input files listed in the comment (1 x .cue and 4 x .bin) with those exact sizes, CRCs, SHA1s and filenames.

Now I'm generating a CHD with chdman 0.238:

Code: Select all

chdman createcd -i "Road Avenger (USA).cue" -o "road avenger (usa).chd"
chdman's info output gives me the following:

Code: Select all

chdman - MAME Compressed Hunks of Data (CHD) manager 0.238 (mame0238)
Input file:   road avenger (usa).chd
File Version: 5
Logical size: 349,995,456 bytes
Hunk Size:    19,584 bytes
Total Hunks:  17,872
Unit Size:    2,448 bytes
Total Units:  142,972
Compression:  cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC)
CHD size:     144,288,525 bytes
Ratio:        41.2%
SHA1:         2de47da786a49e07232662e6a33cb2fb17004280
Data SHA1:    28e2f7cf2e3972c54bff3826095084bd19e49fa9
Metadata:     Tag='CHT2'  Index=0  Length=93 bytes
              TRACK:1 TYPE:MODE1_RAW SUBTYPE:NONE FRAMES:135126 PREGAP:0 P
Metadata:     Tag='CHT2'  Index=1  Length=90 bytes
              TRACK:2 TYPE:AUDIO SUBTYPE:NONE FRAMES:1133 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=2  Length=89 bytes
              TRACK:3 TYPE:AUDIO SUBTYPE:NONE FRAMES:878 PREGAP:150 PGTYPE
Metadata:     Tag='CHT2'  Index=3  Length=90 bytes
              TRACK:4 TYPE:AUDIO SUBTYPE:NONE FRAMES:5828 PREGAP:150 PGTYP
I've also tried converting the cue/bins to a v4 CHD with chdman 0.140, then converting that CHD to v5 with chdman 0.170 and 0.238 - the Data SHA1 (respectively "Raw SHA1" in the older v4 versions) is consistently 28e2f7cf2e3972c54bff3826095084bd19e49fa9. Just for fun I checked all of the SHA1s of the CHD files themselves, none of those is 05fa6ae67687aacdf99fe939b0f04ce13b6d527b.

Where is 05fa6ae67687aacdf99fe939b0f04ce13b6d527b coming from? Is this SHA1 (or the checksums of the source files) just wrong or am I missing something?
User avatar
spludlow
Posts: 34
Joined: Thu Jan 24, 2019 2:15 pm
Contact: Website

Re: Confused about softwarelist CHD SHA1s

Hello

I can't really help you out, but I ran through this problem some time ago, and was never able to fully resolve it.

But I was was to get some SHA1 matches using older chdman (as you have tried) you may just need to try some different versions.

I ran some code to run chdman for a load of versions on the same BIN/CUE and see what came out.

These where my notes:

0139 4 First to work with .cue
0140 4 SHA1 change
0146 5 V up - same SHA1 - parameter passing format changed
0147 - ?Bug Error creating CHD file file not writeable
0149 5 SHA1 change (PSX OK)
0175 5 last PSX OK
0176 5 SHA1 change

Where I put "SHA1 change" then the hash was different on the same file with a different chdman version.

The V4 -> V5 bump does not change the SHA1 but various other commits to the chdman code have.

It may just be the case that some disk software lists have broken SHA1s (like segacd) I'm pretty sure that one gave me grief.

Cheers
Haze
Posts: 15
Joined: Thu Nov 06, 2014 1:16 pm

Re: Confused about softwarelist CHD SHA1s

yeah, there have been bugfixes to CHDman over the years.

it should probably be assumed the old versions are bad and should be reconverted.
cpw83
Posts: 5
Joined: Tue Jul 03, 2018 6:37 pm

Re: Confused about softwarelist CHD SHA1s

Thanks, I wasn't aware that there were significant changes in the different chdman versions (respectively their outputs), I assumed that was only the case for the ones with a CHD version change, so that 0.146 to 0.239 would produce the exact same output.
spludlow wrote: I ran some code to run chdman for a load of versions on the same BIN/CUE and see what came out.

These where my notes:

0139 4 First to work with .cue
0140 4 SHA1 change
0146 5 V up - same SHA1 - parameter passing format changed
0147 - ?Bug Error creating CHD file file not writeable
0149 5 SHA1 change (PSX OK)
0175 5 last PSX OK
0176 5 SHA1 change

I can fully confirm this, I just did the same from 0.139 to 0.239 with my example files to see if the SHA1 I'm looking for is somewhere in there, and indeed it is: The listed version of this CHD is a v5 that was made with a chdman version between 0.149 and 0.175.

Return to “MAME Discussion”