For Sega consoles (all of them i know), it's actually the first 256 bytes which are the header. libmirage allows me to get the 'real' data without having to care about fileformat gunk (cue/bin MODE2/2352 has a little prefix for instance) or ecc bytes (this one is not really a problem since all cd modes sectors are larger than 2048 at least). A exception: as far as i can tell, Sega mega-cd has two headers glued together to give 512 bytes at the start of sector 0. Since redump uses that second one (AFAIC) i'm using that.
After extracting the bytes, i do a md5sum of them. Since those headers are part of the original data, all (non-corrupted) versions of any iso/nrg/cue|bin/etc will have the same md5sum.
There was another reason to do it like this, from a cursory look at the redump site on sega cd, it's not easy to parse out the the correct 'actual serial' across versions because a great deal of them look incorrect (but the header is correct, since it's incredibly hard to get wrong).
For ps1, the serial is quite standardized (with some exceptions i've encountered).
It's basically the name of the executable in the 'BOOT' line inside system.cnf which is the console boot file. If that file doesn't exist, i try the cd volume descriptor and sanity check it (only game i 'have' that i've had this necessary was King's Field(Japan)). In either case, i then transform it into the redump standard (remove dots, uppercase, add '-' separator if missing). This was actually the main reason libmirage and iso parser was needed, because it's not exactly easy to find a utility that can access most dump formats and still extract files without mounting.
It's still not portable to windows (mostly because libmirage is not portable - as far as i know).
I'm planning to use the script on m3u files (that mednafen retroarch cores support) as a target of configurations names (find config with filename 'id', copy it over to the m3u name). Since m3u support multiple cds in retroarch you would only need a single config (cd1 on the m3u) to apply to all cd changes).
If only i can convince the people doing those configs to use this scheme ofc. That's the part i'm not confident on (see no windows support).
I've not investigated nintendo consoles yet.