Refactored handshake routine to support random nonce/sha1/base64 routines per rfc. more cleanup