keis / base58

Base58 and Base58Check implementation compatible with what is used by the bitcoin network.
MIT License
180 stars 59 forks source link

b58encode_check does not take a str as input #45

Closed hukkin closed 4 years ago

hukkin commented 4 years ago

b58encode_check only takes bytes as input. This is inconsistent with b58encode, which can handle a Union[str, bytes] as input.

hukkin commented 4 years ago

Maybe the proper fix is to not change b58encode_check though, but instead throw a TypeError for b58encode("string") calls. So only allow bytes for that too. This is what base64 stdlib does. This would be a breaking change however.

keis commented 4 years ago

This is a very persistent topic. Originally it was operating on str which I think was a mistake, the promoted usage is bytes in bytes out. Supporting str has been requested before and I think by now there's probably a lot of code using that. I agree it would be more proper to simply go only bytes but I still prefer the pragmatic option of adding scrub input to this call too.

For reference #15 #16 #27