Closed 0xc0de4c0ffee closed 1 year ago
You can implement base36 by yourself. It should be straightforward, maybe 10 lines of code. Check out source code of scure-base for base32 implementation. It makes it really easy.
That base36 implementation doesn't seem right.
See this: https://github.com/paulmillr/scure-base/blob/b266c73dde977b1dd7ef40ef7a23cc15aab526b3/index.ts#L283
That base36 implementation doesn't seem right.
See this: https://github.com/paulmillr/scure-base/blob/b266c73dde977b1dd7ef40ef7a23cc15aab526b3/index.ts#L283
I tried scure-base
but I'm not sure about radix2 and padding for base36?
base36 k active base36 [0-9a-z] case-insensitive - no padding https://www.ietf.org/archive/id/draft-multiformats-multibase-04.html
const base36 = utils.chain(utils.radix2(<??>), utils.alphabet('0123456789abcdefghijklmnopqrstuvwxyz'), utils.padding(<??>), utils.join(''));
// throw new Error('radix2: bits should be in (0..32]'); // convertRadix2: invalid data word=35 from=5
it's not radix2 -- it's radix
for padding maybe no padding
For future we'll try to explore multi-sig keys and full IPNS records signing features.
+I've learn more from scure-base as we need max optimized base-x encoder/decoder in Solidity contracts for our deeper ENS+IPFS integration. Our current base36 decoder function is ticking ~350k gas *(view only) without overflowing. Base36 decoder : https://github.com/namesys-eth/ipfs2-eth-resolver/blob/main/src/IPFS2ETH.sol#L166 ENS based IPFS gateway : https://k51qzi5uqu5dhhcu1pop9pynjg2g3l6vrlt379x6huzy2zhyg54o1u6csnuwi3.ipfs2.eth.limo/
Err, sorry.. I mixed up pubkey with prefixed pubkeybytes, & then forgot to run test as it was simple one line edit. 🙏
thanks @0xc0de4c0ffee
resolves #9
I've some questions commented out on codes for review 🙏