Счетный sha256сум DVD

1423
hpn

У меня есть сгоревший DVD с ISO-изображения. У меня также есть sha256 сумма ISO-изображения. Чтобы сравнить хэши, я создал ISO-образ на DVD и выполнил его sha256sum image.iso, но он отличается от хеша исходного изображения.

Это правильный способ расчета хеша DVD? Если нет, то почему это не работает?

Изменить: Может кто-то объяснить причину, которую Аарон Миллер предоставил в комментарии. Есть ли способ сделать файл iso с точно такими же параметрами, как и исходный iso?

5
Теория верна, но не учитывает различий между параметрами, используемыми при создании вашего ISO, и теми, которые использовались при создании того, из которого вы записали DVD. Я не уверен, возможно ли или как можно определить особенности, которые вошли в оригинальное создание ISO, все же. Aaron Miller 10 лет назад 2
Для целей ECC существует отступ в 16 секторных границ. Проверьте созданный ISO, чтобы увидеть, немного ли он больше оригинала. Диск мог заполнить его при физической записи данных, и тогда все, что вы использовали для создания ISO-образа, не отменило этот эффект. Brian 10 лет назад 0

3 ответа на вопрос

6
ubiquibacon

The only way I have found to do this is to hash the files themselves, not the images. Using a tool like Febooti Hash & CRC (Windows) or Quick Hash GUI you can just select all the files in question, right click, then record the hash. You can do the same thing from the command line with sha256sum too of course. After you burn those files to a disc browse to the files on the disc and check the hash as you did before. The hashes should match.

Additional thoughts:

You indicate your current process is to create an iso from the disc you want to check. I would argue this is an extra and unnecessary step. Just put the disc in and hash the files on the disc as I have suggested and compare them to the hash of the files that are on your original image. No need to create an iso first so this should be a lot faster.

3
dtmland

UPDATE:

Is this a correct way to calculate hash of a DVD?

First, take a sha256sum of the DVD itself as done on this site:

... you’ve already burned the CD and now you’d like to go back and check it? As long as you have the sha1sum or md5sum it’s simple.

...

DVD-RW drive is /dev/hda

g33kgrrl@home ~/Desktop$ sha1sum /dev/hda

89164d79d84f483c3642f25507186e58bf5fc0d8 /dev/hda

While they use sha1sum, it should work the same for sha256sum. First, compare that with the hash of your original iso.

If not, why doesn't it work?

As this user points out:

in certain cases the size can be slightly different because there are trailing zeroes in either the copy or the original image

He provides some steps to find out if this is the case, quote:

For example, if copy.iso is smaller than orig.iso:

sha1sum copy.iso head -c $(stat -c %s copy.iso) orig.iso 

Of course you should also check that the trailing bytes are just zeroes:

od -j $(stat -c %s copy.iso) orig.iso 

And finally back to your new question:

Is there a way to make iso file with exactly the same options as the original iso?

I have not yet found a way to do this. However, once you have the hashes of each step, you can at least see where the difference occurred. My guess is that the program that burns your ISO file performs some steps that are necessary for burning but that also modify the image somehow?

Somewhat out of the scope of this question, but it would be interesting to see if it is modified the same every time. In other words, burn multiple discs and see if there hashes are all the same?

Original answer:

Not sure if this satisfies your question (perhaps your existing application already performs this function)

But if you get the ImgBurn utility (windows utility, sorry) it has a feature to "verify" a disc using an ISO image.

My guess is that under the hood this performs some extra steps in order to achieve what you are trying to do. Shame that it isn't open source, or you could pull up the code and see exactly what is happening.

Perhaps there are other burn utilities that have similar functionality and are open source?

0
Steven

Это сработало для меня (хотя заняло около 20 минут):

# dd if=/dev/sr0 |sha256sum 
Это похоже на случай UUOC, только вместо `cat` вы использовали` dd`. Вот почему это заняло 20 минут. Dmitry Grigoryev 7 лет назад 0
Сожалею. Не знаю, что такое "UUOC". Steven 7 лет назад 0

Похожие вопросы