-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Base8 Spec #60
Add Base8 Spec #60
Conversation
- adds support for all the encoding in https://github.com/multiformats/multibase/blob/master/multibase.csv - better errors showing the invalid chars and inputs - `names` and `codes` export the full object that maps names/codes to base instances - two news methods exported, `encoding` and `encodingFromData` - added all the spec tests https://github.com/multiformats/multibase/tree/master/tests This module now only uses 2 base encoding implementations, 1 generalised rfc4648 and 1 generalised btc like. Note: `base8` deviates from the spec tests outputs but aligns with multiformats/multibase#60
0813aaf
to
e88ecae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabianhjr so far so good! Can we add a ## Decoding
section as well? Feel free to liberally C/P from the 4648 spec. Also won't hurt to link to it: https://tools.ietf.org/html/rfc4648
@hugomrdias when time permits can you check that the spec-as-written makes sense? You were the last to implement stuff in this area... |
I think it would be best to wait until the encoding is a go before trying to spec the decoding. As far as I know this encoding would fit what was implemented in multibase-js however will wait for @hugomrdias. |
Thanks @hugomrdias. The decoding section has been added @ribasushi. |
Hi @Stebalien, I think this is ready to be merged. UwU |
🚀 |
This is a first throw at specifying a Base8 encoding, solves some issues of #59 and multiformats/go-multibase#26
Currently the test vectors mapped to the octal value of each byte so encoding and decoding would be harder than need be and encoded bytearray values would be larger (if each byte is mapped to 3 chars) or unpredictable (if, as currently, there are some chars encoded to different octal lengths)
For example, the first test vector was:
(In chunks of 3)
["104","312","615","453","347","216","230","266","151","364","624","403","127","314","534","474","564","320","645","563","162","044","1"]
(In chunks of 8)
["10431261","54533472","16230266","15136462","44031273","14534474","56432064","55631620","441"]
And
312
seems to be the encoding ofe
sometimes in some places likeposition ≡ {1,2} mod 3
.