This repository was archived by the owner on Aug 24, 2021. It is now read-only.
feat: more encoding, errors, spec tests#55
Merged
hugomrdias merged 11 commits intomasterfrom Jun 9, 2020
Merged
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
rvagg
reviewed
Jun 4, 2020
rvagg
reviewed
Jun 4, 2020
rvagg
reviewed
Jun 4, 2020
vmx
reviewed
Jun 4, 2020
Member
Author
|
@rvagg can you have another look before i merge/release ? |
ribasushi
reviewed
Jun 4, 2020
ribasushi
reviewed
Jun 4, 2020
ribasushi
left a comment
There was a problem hiding this comment.
@hugomrdias suggesting stripping a number of no-longer-relevant comments
rvagg
approved these changes
Jun 5, 2020
Member
rvagg
left a comment
There was a problem hiding this comment.
+1 along with the removal of those comments about spec differences that @ribasushi is pointing out
… upper and lower chars in the alphabet
ribasushi
reviewed
Jun 7, 2020
vmx
reviewed
Jun 8, 2020
|
Hi, multiformats/multibase#60 has been merged so the changed test vectors should now match with master. |
vmx
reviewed
Jun 9, 2020
vmx
approved these changes
Jun 9, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
namesandcodesexports the full object that maps names/codes to base instancesencodingandencodingFromDataThis module now only uses 2 base encoding implementations, 1 generalised rfc4648 and 1 generalised btc like.
Note:
base8deviates from the spec tests outputs but aligns with multiformats/multibase#60closes #49
closes #38
closes #46
closes #53
closes #26
Benchmarks
new
identity x 1,225,963 ops/sec ±0.54% (83 runs sampled)
base2 x 282,486 ops/sec ±0.41% (89 runs sampled)
base8 x 564,588 ops/sec ±0.50% (88 runs sampled)
base10 x 131,183 ops/sec ±0.49% (87 runs sampled)
base16 x 665,055 ops/sec ±0.50% (86 runs sampled)
base16upper x 664,900 ops/sec ±0.42% (88 runs sampled)
base32hex x 746,598 ops/sec ±0.48% (87 runs sampled)
base32hexupper x 747,017 ops/sec ±0.57% (89 runs sampled)
base32hexpad x 740,950 ops/sec ±0.51% (87 runs sampled)
base32hexpadupper x 744,495 ops/sec ±0.54% (87 runs sampled)
base32 x 745,253 ops/sec ±0.51% (88 runs sampled)
base32upper x 744,605 ops/sec ±0.54% (90 runs sampled)
base32pad x 740,862 ops/sec ±0.48% (86 runs sampled)
base32padupper x 740,459 ops/sec ±0.53% (88 runs sampled)
base32z x 737,197 ops/sec ±0.49% (87 runs sampled)
base36 x 190,946 ops/sec ±0.52% (87 runs sampled)
base36upper x 190,731 ops/sec ±0.46% (91 runs sampled)
base58btc x 209,785 ops/sec ±0.52% (88 runs sampled)
base58flickr x 209,151 ops/sec ±0.61% (86 runs sampled)
base64 x 812,407 ops/sec ±0.49% (89 runs sampled)
base64pad x 785,924 ops/sec ±0.53% (89 runs sampled)
base64url x 815,979 ops/sec ±0.50% (89 runs sampled)
base64urlpad x 781,622 ops/sec ±0.50% (87 runs sampled)
Fastest is identity
old
base1:
base2 x 30,876 ops/sec ±0.80% (86 runs sampled)
base8 x 78,758 ops/sec ±0.64% (89 runs sampled)
base10 x 87,526 ops/sec ±0.55% (89 runs sampled)
base16 x 367,510 ops/sec ±0.78% (83 runs sampled)
base32 x 267,862 ops/sec ±0.62% (90 runs sampled)
base32pad x 255,571 ops/sec ±0.68% (87 runs sampled)
base32hex x 267,402 ops/sec ±0.60% (88 runs sampled)
base32hexpad x 254,547 ops/sec ±0.52% (87 runs sampled)
base32z x 257,585 ops/sec ±0.54% (90 runs sampled)
base58flickr x 135,862 ops/sec ±0.44% (87 runs sampled)
base58btc x 135,780 ops/sec ±0.66% (89 runs sampled)
base64 x 400,185 ops/sec ±0.60% (87 runs sampled)
base64pad x 378,530 ops/sec ±0.56% (87 runs sampled)
base64url x 376,370 ops/sec ±0.58% (86 runs sampled)
base64urlpad x 384,648 ops/sec ±0.94% (88 runs sampled)
Fastest is base64
/cc @Gozala @ribasushi
BREAKING CHANGE:
namesandcodesexport the full object that maps names/codes to base instances instead of just the keys