Base58 is a group of binary-to-text encoding schemes used to represent large integers as alphanumeric text.
-
Copyright 2011 Google Inc.
-
Copyright 2018 Andreas Schildbach
-
Licensed under the Apache License, Version 2.0 (the "License");
-
you may not use this file except in compliance with the License.
-
You may obtain a copy of the License at
-
Unless required by applicable law or agreed to in writing, software
-
distributed under the License is distributed on an "AS IS" BASIS,
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-
See the License for the specific language governing permissions and
-
limitations under the License.
-
Base58 is a way to encode Bitcoin addresses (or arbitrary data) as alphanumeric strings.
-
-
Note that this is not the same base58 as used by Flickr, which you may find referenced around the Internet.
-
-
You may want to consider working with {@link PrefixedChecksummedBytes} instead, which
-
adds support for testing the prefix and suffix bytes commonly found in addresses.
-
-
Satoshi explains: why base-58 instead of standard base-64 encoding?
-
- Don't want 0OIl characters that look the same in some fonts and
-
could be used to create visually identical looking account numbers.</li>
- A string with non-alphanumeric characters is not as easily accepted as an account number.
- E-mail usually won't line-break if there's no punctuation to break at.
- Doubleclicking selects the whole number as one word if it's all alphanumeric.
-
-
However, note that the encoding/decoding runs in O(n²) time, so it is not useful for large data.
-
-
The basic idea of the encoding is to treat the data bytes as a large number represented using
-
base-256 digits, convert the number to be represented using base-58 digits, preserve the exact
-
number of leading zeros (which are otherwise lost during the mathematical operations on the
-
numbers), and finally represent the resulting base-58 digits as alphanumeric ASCII characters.