Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: CUETools DB: How is the crc32 CTDBID calculated? (Read 2411 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

CUETools DB: How is the crc32 CTDBID calculated?

I'm trying to verify an entire CD against the CUETools DB, but the CTDBID I calculate doesn't agree. The documentation says that the CTDBID is the crc32 hash of the whole disc (except for some leadin/leadout samples). Does anybody know how this is calculated in practice and/or why the following doesn't work?

The Audio CD I'm testing is the Miles Davis's Kind of Blue (1997 Columbia CK 64935 version.) A listing of the known CTDBIDs for Kind of Blue is online.

I calculate the crc32 hash using the following. (This is from the command line on a Mac.)
Code: [Select]
$ crc32 /dev/cdrom
4fedf7e5

However, none of the CTDBIDs in the database match 4fedf7e5 – the three most common are 6A2518C1, DD95C727, and 2EB76532.

The table of contents for this disc doesn't have any leadin or leadout tracks, so the method I'm using should work.
Code: [Select]
Reading toc data...

Track   Mode    Flags  Start                Length
------------------------------------------------------------
 1      AUDIO   0      00:00:00(     0)     09:25:32( 42407)
 2      AUDIO   0      09:25:32( 42407)     09:49:05( 44180)
 3      AUDIO   0      19:14:37( 86587)     05:37:43( 25318)
 4      AUDIO   0      24:52:05(111905)     11:35:57( 52182)
 5      AUDIO   0      36:27:62(164087)     09:25:73( 42448)
 6      AUDIO   0      45:53:60(206535)     09:32:07( 42907)
Leadout AUDIO   0      55:25:67(249442)

To test that the crc32 I'm calculating is right, I did this:
Code: [Select]
$ dd if=/dev/cdrom of="Kind of Blue.pcm"
$ crc32 "Kind of Blue.pcm"
4fedf7e5

The number of bytes in "Kind of Blue.pcm" is correct (2532*249442 = 586687584), and the crc32 hash agrees. I also wrote a C program to read the bytes from the CD into an array and calculate the crc32 hash and got the same thing.

So what gives?

Re: CUETools DB: How is the crc32 CTDBID calculated?

Reply #1
It makes no sense for the ID to be linked with the audio data. Think about it. If you have an error then the disc wouldn't be recognized. The system simply couldn't work this way.

I thought the program was open source.

Re: CUETools DB: How is the crc32 CTDBID calculated?

Reply #2
It makes no sense for the ID to be linked with the audio data. Think about it. If you have an error then the disc wouldn't be recognized. The system simply couldn't work this way.

There are other IDs too, but it does appear that CTDBID is linked to the audio data.

Here is the relevant part of the CUETool DB Wiki:

Quote from: CUETool DB Wiki
What information does the database contain per each CD?
  • CD TOC (Table Of Contents), i.e. length of every track (TOCID). Disc pregap length (HTOA) and/or CD-extra data track length stored separately (if any).
  • Offset-finding checksum, a small (16-byte) recovery record for a set of samples throughout the CD, which allows detection of the offset difference between the rip in the database and your rip, even if your rip contains some errors.
  • CRC32 of the whole disc (except for some leadin/leadout samples). (CTDBID)
  • Submission date, artist, title.
  • 180KB recovery record (about twice that for more popular CD's), which is stored separately and accessed only when verifying a broken rip or repairing it.
  • Submission log, including user's ip addresses and CD drive model, which is used to eliminate erroneous submissions, virtual/faulty drives, and to verify if a submission by one user is independently confirmed.

I was hoping that the CTDBID crc32 hash would let me verify that an entire disc image is bit-accurate, instead of doing track-by-track checks.

I thought the program was open source.

It is, but crc32 is used all over the code to check individual tracks too. Finding the part where CTDBID is calculated hasn't been so forthcoming.

Re: CUETools DB: How is the crc32 CTDBID calculated?

Reply #3
FWIW, I think you're making far too many assumptions about these values.

Regardless, this is the CUETools Disc ID for the disc with the times you provided in your original post:
dl3r73tyqlTpaiUG.7dg3Q76CCg-

Make with it what you will.

I may see if I can get you the exact result for the pressing that corresponds with the checksum you gave.

Re: CUETools DB: How is the crc32 CTDBID calculated?

Reply #4
Here you go:
Code: [Select]
[CUETools log; Date: 10/7/2016 9:40:24 PM; Version: 2.1.4]
[CTDB TOCID: dl3r73tyqlTpaiUG.7dg3Q76CCg-] found.
Track | CTDB Status
  1  | (1241/1331) Accurately ripped
  2  | (1241/1331) Accurately ripped
  3  | (1242/1331) Accurately ripped
  4  | (1238/1331) Accurately ripped
  5  | (1235/1331) Accurately ripped
  6  | (1225/1331) Accurately ripped
[AccurateRip ID: 000d2323-004628af-5a0cfd06] found.
Track  [  CRC  |  V2  ] Status
01    [8d109723|ea479212] (000+000/2117) No match
02    [6e5e2dee|8894d538] (000+000/2114) No match
03    [f9a735e5|be28fa47] (000+000/2119) No match
04    [b0304bc6|510f06a7] (000+000/2105) No match
05    [0c07a46a|e5bc5811] (000+000/2099) No match
06    [19bbfc97|48d551dd] (000+000/2038) No match
Offsetted by -2090:
01    [d8d00067] (021/2117) Accurately ripped
02    [4214fbec] (021/2114) Accurately ripped
03    [9e219461] (021/2119) Accurately ripped
04    [f9365ffa] (021/2105) Accurately ripped
05    [787a6679] (021/2099) Accurately ripped
06    [07f3ae24] (020/2038) Accurately ripped
Offsetted by -2088:
01    [b9df7f33] (068/2117) Accurately ripped
02    [a6cf3c66] (070/2114) Accurately ripped
03    [bb203cd5] (070/2119) Accurately ripped
04    [d850d396] (070/2105) Accurately ripped
05    [27164832] (071/2099) Accurately ripped
06    [5571e97f] (063/2038) Accurately ripped
Offsetted by -1958:
01    [deceb0ff] (136/2117) Accurately ripped
02    [3a199b60] (140/2114) Accurately ripped
03    [17c90249] (141/2119) Accurately ripped
04    [7e082e32] (140/2105) Accurately ripped
05    [bae471c2] (140/2099) Accurately ripped
06    [0c41fbc3] (133/2038) Accurately ripped
Offsetted by -1956:
01    [bfde2fcb] (016/2117) Accurately ripped
02    [9ed3dbda] (015/2114) Accurately ripped
03    [34c7aabd] (016/2119) Accurately ripped
04    [5d22a1ce] (016/2105) Accurately ripped
05    [8f91537a] (015/2099) Accurately ripped
06    [59ef371f] (015/2038) Accurately ripped
Offsetted by -1803:
01    [00ff93c1] (200/2117) Accurately ripped
02    [387c204f] (200/2114) Accurately ripped
03    [dee10167] (200/2119) Accurately ripped
04    [888a2dec] (200/2105) Accurately ripped
05    [9d3ac6f6] (200/2099) Accurately ripped
06    [9033741d] (200/2038) Accurately ripped
Offsetted by -1275:
01    [18fa5621] (075/2117) Accurately ripped
02    [188e9e1f] (073/2114) Accurately ripped
03    [c57eb907] (074/2119) Accurately ripped
04    [9bd166cc] (072/2105) Accurately ripped
05    [ef838cb6] (072/2099) Accurately ripped
06    [aad8aafd] (071/2038) Accurately ripped
Offsetted by -1168:
01    [21b755c3] (050/2117) Accurately ripped
02    [a57b179e] (050/2114) Accurately ripped
03    [d4b6ed45] (049/2119) Accurately ripped
04    [bbd88fe6] (049/2105) Accurately ripped
05    [e1a4b8aa] (049/2099) Accurately ripped
06    [e68c92b7] (043/2038) Accurately ripped
Offsetted by -851:
01    [79cf5711] (062/2117) Accurately ripped
02    [82cc0327] (062/2114) Accurately ripped
03    [c8623917] (062/2119) Accurately ripped
04    [5db923fc] (061/2105) Accurately ripped
05    [0eae7916] (062/2099) Accurately ripped
06    [fe4dd32d] (059/2038) Accurately ripped
Offsetted by -834:
01    [f2d30cd7] (038/2117) Accurately ripped
02    [5afb2734] (036/2114) Accurately ripped
03    [bed6d0f1] (036/2119) Accurately ripped
04    [4619faaa] (036/2105) Accurately ripped
05    [9e6bf7b2] (035/2099) Accurately ripped
06    [928e4bbb] (036/2038) Accurately ripped
Offsetted by -758:
01    [5b1fdf1f] (029/2117) Accurately ripped
02    [4ea0b950] (031/2114) Accurately ripped
03    [0ca3d229] (030/2119) Accurately ripped
04    [640723d2] (030/2105) Accurately ripped
05    [30157902] (030/2099) Accurately ripped
06    [1a451b63] (029/2038) Accurately ripped
Offsetted by -652:
01    [f3551f5b] (017/2117) Accurately ripped
02    [29301292] (016/2114) Accurately ripped
03    [0d5cb22d] (016/2119) Accurately ripped
04    [9481131e] (016/2105) Accurately ripped
05    [37e0341a] (015/2099) Accurately ripped
06    [2f22656f] (015/2038) Accurately ripped
Offsetted by -591:
01    [c3adbaa9] (089/2117) Accurately ripped
02    [a960c11b] (089/2114) Accurately ripped
03    [81b3c3ff] (091/2119) Accurately ripped
04    [a927d934] (091/2105) Accurately ripped
05    [0e791886] (091/2099) Accurately ripped
06    [7045f7e5] (085/2038) Accurately ripped
Offsetted by -406:
01    [15c70b5f] (065/2117) Accurately ripped
02    [8ead0d30] (064/2114) Accurately ripped
03    [fbb7a1e9] (064/2119) Accurately ripped
04    [c6369f12] (064/2105) Accurately ripped
05    [66f0a782] (064/2099) Accurately ripped
06    [815deaa3] (061/2038) Accurately ripped
Offsetted by -368:
01    [c9ed7483] (058/2117) Accurately ripped
02    [087fd63e] (058/2114) Accurately ripped
03    [229e2285] (058/2119) Accurately ripped
04    [552d33a6] (056/2105) Accurately ripped
05    [2fc5682a] (057/2099) Accurately ripped
06    [45395277] (053/2038) Accurately ripped
Offsetted by -365:
01    [1b84b2b5] (011/2117) Accurately ripped
02    [1f9736f5] (011/2114) Accurately ripped
03    [4e1c1f33] (011/2119) Accurately ripped
04    [23d4e110] (010/2105) Accurately ripped
05    [eec8babe] (010/2099) Accurately ripped
06    [b9bd2b81] (009/2038) Accurately ripped
Offsetted by -200:
01    [a3030f73] (012/2117) Accurately ripped
02    [159cfe46] (012/2114) Accurately ripped
03    [a62d6895] (012/2119) Accurately ripped
04    [89db22d6] (012/2105) Accurately ripped
05    [f87f788a] (012/2099) Accurately ripped
06    [c210cca7] (012/2038) Accurately ripped
Offsetted by 6:
01    [303f1387] (030/2117) Accurately ripped
02    [9c8cef5c] (030/2114) Accurately ripped
03    [50a32f41] (030/2119) Accurately ripped
04    [4d7fa69a] (030/2105) Accurately ripped
05    [8a0e4992] (029/2099) Accurately ripped
06    [02c3aeab] (030/2038) Accurately ripped
More than 16 offsets match!
Offsetted by -816:
01    [dc5e8203] (000/2117) No match (V2 was not tested)
02    [e5876b7e] (002/2114) Accurately ripped
03    [c3cabd05] (002/2119) Accurately ripped
04    [1e080b26] (002/2105) Accurately ripped
05    [187fe72a] (002/2099) Accurately ripped
06    [4da561f7] (002/2038) Accurately ripped

Track Peak [ CRC32  ] [W/O NULL] [  LOG  ]
--  94.4 [4FEDF7E5] [1A7BD613]  CRC32 
01  94.4 [8123E6D2] [A6A3FE16]         
02  94.4 [07A6114C] [8B46806C]         
03  89.8 [FB56B4FD] [2F66565A]         
04  94.4 [D65A1FD4] [BA688750]         
05  94.4 [4698C446] [B9AB6BCB]         
06  94.4 [0B50C4E3] [CFE83DFB]         

Re: CUETools DB: How is the crc32 CTDBID calculated?

Reply #5
Quote
Offset-finding checksum, a small (16-byte) recovery record for a set of samples throughout the CD, which allows detection of the offset difference between the rip in the database and your rip, even if your rip contains some errors.
Pressings fall under a single CTDBID. The CTDBID is created from the first unique CD submitted. A pressing with the same data at a different offset would fall under that CTDBID already created. You can't assume your CD will always have the same pressing offset as the first CD submitted.
korth