Re: Disc ID Calculation

Darin Adler (darin nospam at bentspoon.com)
Thu, 18 Mar 1999 11:46:49 -0800

>The description of Disc Id Calculation at
>http://www.freeamp.org/cdindex/how.html describes a process
>substantially different from the one implemented in
>cdindex-1.0.0. Can anyone clarify what the intended
>calculation algorithm is? I would assume that the code is
>correct, but it is apparently adding 100 8-bytes frame
>offsets regardless of the number of the tracks on the disk.

The only differences I know of between the web site specification and the
software are these:

1) The zero-padded capital-letter hex ASCII form of the data is fed
into the SHA1 algorithm, not the raw binary data.

2) Instead of having one frame offset for each track, there are
always 99 frame offsets. Any frame offsets beyond the ones for actual
tracks are fed into the SHA1 algorithm as "00000000" ASCII.

>It would also be helpful to have a specification that
>doesn't depend on knowledge of the Linux cdrom interface.
>I'd like to implement an id generator on Solaris, for
>example.

The specification doesn't depend on the Linux CD-ROM interface as far as
I can tell. I implemented the ID calculation for the Macintosh, which has
a different interface, without significant difficulty.

The only requirement is that you can find the number of tracks, start of
each track, and lead-out. Note that getting the lead-out on a Windows
system requres adding 1 frame to a value returned by the operating
system. That's not required on all systems -- for example, on the
Macintosh the driver returns the correct value for the lead-out.

-- Darin Adler