Jump to content

Base36

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Anthrópinos81638 (talk | contribs) at 23:25, 13 September 2020 (Replaces obsolete tag.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Base36 is a binary-to-text encoding scheme that represents binary data in an ASCII string format by translating it into a radix-36 representation. The choice of 36 is convenient in that the digits can be represented using the Arabic numerals 0–9 and the Latin letters A–Z[1] (the ISO basic Latin alphabet).

Each base36 digit needs less than 6 bits of information to be represented.

Conversion

Signed 32- and 64-bit integers will only hold at most 6 or 13 base-36 digits, respectively (that many base-36 digits can overflow the 32- and 64-bit integers). For example, the 64-bit signed integer maximum value of "9223372036854775807" is "1Y2P0IJ32E8E7" in base-36. Similarly, the 32-bit signed integer maximum value of "2147483647" is "ZIK0ZJ" in base-36.

Standard implementations

Java SE supports conversion from/to String to different bases from 2 up to 36. For example, [1] and [2]

Just like Java, JavaScript also supports conversion from/to String to different bases from 2 up to 36. [3]

PHP, like Java, supports conversion from/to String to different bases from 2 up to 36. Use the base_convert function, available since PHP 4.

Go supports conversion to string to different bases from 2 up to 36 using the built-in strconv.FormatInt(), and strconv.FormatUint() functions[2][3], and conversions from string encoded in different bases from 2 up to 36 using the built-in strconv.ParseInt(), and strconv.ParseUint() functions.[4][5].

See also

References

  1. ^ Hope, Paco; Walther, Ben (2008), Web Security Testing Cookbook, Sebastopol, CA: O'Reilly Media, Inc., ISBN 978-0-596-51483-9
  2. ^ https://golang.org/pkg/strconv/#FormatInt
  3. ^ https://golang.org/pkg/strconv/#FormatUint
  4. ^ https://golang.org/pkg/strconv/#ParseInt
  5. ^ https://golang.org/pkg/strconv/#ParseUint