utils.hash: Python 3 support
utils.hash: Python 3 support

All Python 3 crypto functions work with bytes natively, so we need to
adapt utils.hash accordingly.

For Sha1Hmac, we assume the key and salt to always be strings, which are
encoded to utf-8 byte sequences. The old "text" argument is allowed to
be either a string, or bytes directly and is renamed to "msg" to better
reflect the fact that it need not strictly be text.

Also adapt _FingerprintFile to read files in binary mode, which will
yield byte sequences that can be fed directly to the hash function.

Signed-off-by: Apollon Oikonomopoulos <ed81ed0a45ccd5c8869bda52e38353a6299ee39e@dmesg.gr>

ganeti/ganeti,mbakke/ganeti,mbakke/ganeti,mbakke/ganeti,ganeti/ganeti,ganeti/ganeti