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?