cryptocoinjs / base-x

Encode/decode any base
MIT License
312 stars 75 forks source link

allow for array alphabet #39

Closed aakilfernandes closed 7 years ago

aakilfernandes commented 7 years ago

Hi, this is a PR which allows for alphabets as arrays. It may contain a bit of a performance hit since apparently treating strings like arrays cause a bit of a performance hit.

I needed this to work with a base system with multi-character encoding systems (ie treating bip39 like an encoding scheme)

jprichardson commented 7 years ago

Interesting. What's the use case? Looks bip39-esque..

aakilfernandes commented 7 years ago

Yup uses the bip39 words. But bip39 has some checksum stuff rolled into it so this is just for a generic converter.

Use case is for a 2fa wallet where users need to put some code hash into a smart contract to unlock fund.

dcousens commented 7 years ago

ACK-ish, but not with the inline BIP39 alphabet included.. lets keep the test cases minimal.

dcousens commented 7 years ago

ACK, but I'm going to reduce/remove the included massive alphabet, and also going to change the API to instead default a delimiter parameter