I’ve implemented a prototype of hashing over serialization:
https://github.com/Kotlin/kotlinx.serialization/issues/163
I’d appreciate any feedback, feel free to vote and comment whether you are (already) missing this functionality, want it to use when it’s ready or need something specific (e.g. MD5 only)