For the hash_encode, it looks like it is simply taking x reversing it and encoding it in hex. [::-1] is the notation to reverse a string.
For the hash_decode, it looks like it is taking a hex input and decoding/reversing it back to the original.
I don't actually see the hash_encode/hash_decode variables being anywhere in the code snippets provided.
Yes thank you, that is actually being used elsewhere. It was just weird being coupled with the rest of the code.
The "Seed version" string is the key for the hmac.new function which could really be any phrase, they just chose to use that one. An HMAC is a cryptographic hash that uses a key to sign a message. A receiver could verifiy the hash by recomputing it using the same key.
So it looks like it is hashing the seed mnemonic encoded into hex and checking which prefix it starts with to determine if it is a new or old version of the seed format.
Indeed, but then I guess the string must be "Seed version" in our electrum, otherwise the whole verification system won't work.
So if I were to change that string, then the whole verification system would be pointless.