Fix encoding issues, RFC4226 discrepancies

I encountered insane UTF8/ASCII issues with Google-provided base32 keys - some kind of encoding issue took place due to the fact that the key buffer was not properly initialized as an ASCII buffer.

This patch fixes the ASCII buffer issue, allowing otp generation to work consistently.

This patch also implements truncation as per RFC4226 instead of using substrings.