Fix crash when using HMAC-SHA256

This fixes a crash(EXC_BAD_ACCESS) when using HMAC-SHA256 by using
CC_SHAxxx_DIGEST_LENGTH.

Also use base64 encoding function on NSData
This change doesn’t seem related… or correct.