This was off by one for large numbers, should be correct now.

Also, we shouldn't include padding when decoding base64 since we can
calculate the length exactly.