They hired some smart people who are not cryptographic experts and now their cryptography is broken. Which is pretty much the story for anyone who has ever created a custom cryptographic system (and the story of SSL for the first few years).
Analysis looks sound to me, using msg content to derive the key is generally bad form, especially messages are known to attackers and sent repeatedly. (eg. Hi)
It looks like a bunch of convoluted code that doesn't actually accomplish anything.
Are there special properties of the random bits of parts of various hashes that makes it more 'random'?
To me it looks like repeatedly sending the same message, or a message whose hash varied by a few bits, would leak part of the auth key, basically the person probably doesn't know what they are doing and are just adding extra 'stuff' to assure themselves it's secure.
They hired some smart people who are not cryptographic experts and now their cryptography is broken. Which is pretty much the story for anyone who has ever created a custom cryptographic system (and the story of SSL for the first few years).