Skip to content

Instantly share code, notes, and snippets.

View SeriousBusiness100's full-sized avatar

SeriousBusiness100

View GitHub Profile
@SeriousBusiness100
SeriousBusiness100 / README.md
Created December 27, 2022 07:22 — forked from antimatter15/README.md
Arbitrary Base Conversion Algorithm (Javascript)

Arbitrary Base Conversion Algorithm

This is a function that can convert between arbitrary bases implemented in both Javascript and Python.

Many existing implementations, such as https://rot47.net/base.html or https://gist.github.com/inflammable/2929362 use a number as the internal representation, and thus can't safely encode/decode more than 8 letters of Base64 encoded text, or 9 letters of Base58 text (which isn't enough for parsing a Bitcoin address).

Other implementations rely on complicated third party libraries for bignum (e.g. https://rosettacode.org/wiki/Non-decimal_radices/Convert#JavaScript).

Several implementations required converting to Uint8Arrays (Base 256) as an intermediate. Others were essentially ports of complicated C implementations (see https://github.com/cryptocoinjs/base-x/blob/master/src/index.js).

*** SHED SKIN Python-to-C++ Compiler ***
Copyright 2005-2013 Mark Dufour; License GNU GPL version 3 (See LICENSE)
infer.py: perform iterative type analysis
we combine two techniques from the literature, to analyze both parametric
polymorphism and data polymorphism adaptively. these techniques are agesen's
cartesian product algorithm [0] and plevyak's iterative flow analysis [1] (the data
polymorphic part). for details about these algorithms, see ole agesen's
excellent Phd thesis [2]. for details about the Shed Skin implementation, see mark