Ok, I used this:

Qt Code:
  1. QCryptographicHash hash(QCryptographicHash::Md5);
  2. QFile in("/dev/cdrom");
  3.  
  4. if (in.open(QIODevice::ReadOnly)) {
  5. char buf[2048];
  6. int bytesRead;
  7. qint64 overallBytesRead = 0;
  8.  
  9. while ((bytesRead = in.read(buf, 2048)) > 0) {
  10. overallBytesRead += bytesRead;
  11. hash.addData(buf, 2048);
  12. }
  13.  
  14. in.close();
  15. qDebug() << "overall bytes read:" << overallBytesRead;
  16. qDebug() << hash.result().toHex();
  17. }
  18. else {
  19. qDebug() << "Failed to open device!";
  20. }
To copy to clipboard, switch view to plain text mode 

After completed, overallBytesRead is "8738865152", but the file size of image is "8738846720". He reads more bytes as on dvd is! I'm confused!