base64 and sha1 stuff for ws proto