Extra 0 byte sometimes added on decode FromBase62()
Closed this issue · 2 comments
CaryJ commented
We found that sometimes we were getting an extra 0 byte back from FromBase62. The following change to EncodingExtensions.cs fixed it:
75c75,79
< stream.Write(new byte[] { (byte)(index << (mod)) }, 0, 8 - mod);
---
> if (mod > 0)
> {
> // only pad with more bits if it didn't come out at an exact byte boundary
> stream.Write(new byte[] {(byte)(index << (mod))}, 0, 8 - mod);
> }
CaryJ commented
Thank you!