05nelsonm / encoding

A Kotlin Multiplatform library for configurable, streamable, efficient and extensible Encoding/Decoding with support for base16/32/64.
Apache License 2.0
33 stars 5 forks source link

`Base32` is broken #92

Closed 05nelsonm closed 1 year ago

05nelsonm commented 1 year ago

When working on https://github.com/05nelsonm/kmp-tor/issues/274 updating to 1.2.0 results in test failures.

expected:<OBTD[DB6TEGTGVPNR2XDA5X5DEB4YXGLEHJHNGIIVBGF33]S2HNNRQ====> but was:<OBTD[FCGTEKTGXPVR23DA7YFDEB5IZGLEHJH5GIIVBKGL5]S2HNNRQ====>
Expected :OBTDDB6TEGTGVPNR2XDA5X5DEB4YXGLEHJHNGIIVBGF33S2HNNRQ====
Actual   :OBTDFCGTEKTGXPVR23DA7YFDEB5IZGLEHJH5GIIVBKGL5S2HNNRQ====

image

The correct value should be OBTDFCGTEKTGXPVR23DA7YFDEB5IZGLEHJH5GIIVBKGL5S2HNNRQ====

This is attributed to the change in the base32 bitwise operations.

05nelsonm commented 1 year ago

Looks like only base32 default is affected.

05nelsonm commented 1 year ago

PR #95 showed that Base32 Hex and Crockford implementations were also borked.