Passed basic tests by converting sourceAlphabet to base 10, then from base 10 to targetAlphabet. However now realised that input and output are being interpreted as least-significant bit first when they should actually be most-significant bit first.