On Mon, May 02, 2022 at 09:58:35AM +0200, Marc-Andre Lemburg wrote:
> Just a word of warning: numeric bases are not necessarily the same
> as numeric encodings. The latter usually come with other formatting
> criteria in addition to representing numeric values, e.g. base64 is
> an encoding and not the same as representing numbers in base 64.
Correct. base64 is for encoding byte-strings, not numbers:
>>> binascii.hexlify(b"Hello world")
b'48656c6c6f20776f726c64'
Of course we can treat any byte string as a base-256 number, in which
case "Hello world" has the value 87521618088882671231069284.
There's no obvious collation/alphabet to use for base 64, but if we use (say)
ASCII digits + uppercase + lowercase + "!@"
then that "Hello world" number 875...284 above is:
4XbR6nl87TlScna (in base 64)
which is completely different from the base64 encoding.
By the way, in base 64 that "Hello world" number has:
* digital sum of 445;
* digital root of 4, with persistance of 3;
* digital product of 261040984907288205312;
* zero-free digital product root of 48, with persistance of 7.
There is absolutely no significance to any of this. I'm just geeking out :-)
--
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/C6CHPDJEXNIBNOMXPNBOHIWB4RFSN3BO/
Code of Conduct: http://python.org/psf/codeofconduct/