mirror of
https://github.com/bitcoin/bips.git
synced 2025-01-19 05:45:07 +01:00
bip93: make bech32 capitalization consistently lowercase
This commit is contained in:
parent
838fd93219
commit
eb62f6ea71
@ -60,7 +60,7 @@ However, BIP-0039 has no error-correcting ability, cannot sensibly be extended t
|
||||
|
||||
===codex32===
|
||||
|
||||
A codex32 string is similar to a Bech32 string defined in [https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki BIP-0173].
|
||||
A codex32 string is similar to a bech32 string defined in [https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki BIP-0173].
|
||||
It reuses the base32 character set from BIP-0173, and consists of:
|
||||
|
||||
* A human-readable part, which is the string "ms" (or "MS").
|
||||
@ -68,12 +68,12 @@ It reuses the base32 character set from BIP-0173, and consists of:
|
||||
* A data part which is in turn subdivided into:
|
||||
** A threshold parameter, which MUST be a single digit between "2" and "9", or the digit "0".
|
||||
*** If the threshold parameter is "0" then the share index, defined below, MUST have a value of "s" (or "S").
|
||||
** An identifier consisting of 4 Bech32 characters.
|
||||
** A share index, which is any Bech32 character. Note that a share index value of "s" (or "S") is special and denotes the unshared secret (see section "Unshared Secret").
|
||||
** A payload which is a sequence of up to 74 Bech32 characters. (However, see '''Long codex32 Strings''' below for an exception to this limit.)
|
||||
** A checksum which consists of 13 Bech32 characters as described below.
|
||||
** An identifier consisting of 4 bech32 characters.
|
||||
** A share index, which is any bech32 character. Note that a share index value of "s" (or "S") is special and denotes the unshared secret (see section "Unshared Secret").
|
||||
** A payload which is a sequence of up to 74 bech32 characters. (However, see '''Long codex32 Strings''' below for an exception to this limit.)
|
||||
** A checksum which consists of 13 bech32 characters as described below.
|
||||
|
||||
As with Bech32 strings, a codex32 string MUST be entirely uppercase or entirely lowercase.
|
||||
As with bech32 strings, a codex32 string MUST be entirely uppercase or entirely lowercase.
|
||||
For presentation, lowercase is usually preferable, but uppercase SHOULD be used for handwritten codex32 strings.
|
||||
If a codex32 string is encoded in a QR code, it SHOULD use the uppercase form, as this is encoded more compactly.
|
||||
|
||||
@ -131,7 +131,7 @@ We do not specify how an implementation should implement error correction. Howev
|
||||
* Implementations interpret "?" as an erasure.
|
||||
* Implementations optionally interpret other non-bech32 characters, or characters with incorrect case, as erasures.
|
||||
* If a string with 8 or fewer erasures can have those erasures filled in to make a valid codex32 string, then the implementation suggests such a string as a correction.
|
||||
* If a string consisting of valid Bech32 characters in the proper case can be made valid by substituting 4 or fewer characters, then the implementation suggests such a string as a correction.
|
||||
* If a string consisting of valid bech32 characters in the proper case can be made valid by substituting 4 or fewer characters, then the implementation suggests such a string as a correction.
|
||||
|
||||
===Unshared Secret===
|
||||
|
||||
@ -243,7 +243,7 @@ The conversion process consists of:
|
||||
# Choose a 4 bech32 character identifier
|
||||
#* We do not define how to choose the identifier, beyond noting that it SHOULD be distinct for every master seed the user may need to disambiguate.
|
||||
# Set the share index to <code>s</code>
|
||||
# Set the payload to a Bech32 encoding of the master seed, padded with arbitrary bits
|
||||
# Set the payload to a bech32 encoding of the master seed, padded with arbitrary bits
|
||||
# Generating a valid checksum in accordance with the Checksum section
|
||||
|
||||
Along with the codex32 secret, the user must generate ''t''-1 other codex32 shares, each with the same threshold value, the same identifier, and a distinct share index.
|
||||
@ -288,8 +288,8 @@ def ms32_create_long_checksum(data):
|
||||
|
||||
A long codex32 string follows the same specification as a regular codex32 string with the following changes.
|
||||
|
||||
* The payload is a sequence of between 75 and 103 Bech32 characters.
|
||||
* The checksum consists of 15 Bech32 characters as defined above.
|
||||
* The payload is a sequence of between 75 and 103 bech32 characters.
|
||||
* The checksum consists of 15 bech32 characters as defined above.
|
||||
|
||||
A codex32 string with a data part of 94 or 95 characters is never legal as a regular codex32 string is limited to 93 data characters and a long codex32 string is at least 96 characters.
|
||||
|
||||
@ -384,9 +384,9 @@ The inline code in this BIP text can be used as a Python reference.
|
||||
===Test vector 1===
|
||||
|
||||
This example shows the codex32 format, when used without splitting the secret into any shares.
|
||||
The payload contains 26 Bech32 characters, which corresponds to 130 bits. We truncate the last two bits in order to obtain a 128-bit master seed.
|
||||
The payload contains 26 bech32 characters, which corresponds to 130 bits. We truncate the last two bits in order to obtain a 128-bit master seed.
|
||||
|
||||
codex32 secret (Bech32): <code>ms10testsxxxxxxxxxxxxxxxxxxxxxxxxxx4nzvca9cmczlw</code>
|
||||
codex32 secret (bech32): <code>ms10testsxxxxxxxxxxxxxxxxxxxxxxxxxx4nzvca9cmczlw</code>
|
||||
|
||||
Master secret (hex): <code>318c6318c6318c6318c6318c6318c631</code>
|
||||
|
||||
@ -419,7 +419,7 @@ In particular, given an all uppercase codex32 string, we still use lowercase <co
|
||||
===Test vector 3===
|
||||
|
||||
This example shows splitting an existing 128-bit master seed into "random" codex32 shares, using ''k''=3 and an identifier of <code>cash</code>.
|
||||
We appended two zero bits in order to obtain 26 Bech32 characters (130 bits of data) from the 128-bit master seed.
|
||||
We appended two zero bits in order to obtain 26 bech32 characters (130 bits of data) from the 128-bit master seed.
|
||||
|
||||
Master secret (hex): <code>ffeeddccbbaa99887766554433221100</code>
|
||||
|
||||
@ -447,7 +447,7 @@ However, each choice would have resulted in a different set of derived shares.
|
||||
===Test vector 4===
|
||||
|
||||
This example shows converting a 256-bit secret into a codex32 secret, without splitting the secret into any shares.
|
||||
We appended four zero bits in order to obtain 52 Bech32 characters (260 bits of data) from the 256-bit secret.
|
||||
We appended four zero bits in order to obtain 52 bech32 characters (260 bits of data) from the 256-bit secret.
|
||||
|
||||
256-bit secret (hex): <code>ffeeddccbbaa99887766554433221100ffeeddccbbaa99887766554433221100</code>
|
||||
|
||||
@ -476,7 +476,7 @@ Note that the choice to append four zero bits was arbitrary, and any of the foll
|
||||
===Test vector 5===
|
||||
|
||||
This example shows generating a new 512-bit master seed using "random" codex32 characters and appending a checksum.
|
||||
The payload contains 103 Bech32 characters, which corresponds to 515 bits. The last three bits are discarded when converting to a 512-bit master seed.
|
||||
The payload contains 103 bech32 characters, which corresponds to 515 bits. The last three bits are discarded when converting to a 512-bit master seed.
|
||||
|
||||
This is an example of a '''Long codex32 String'''.
|
||||
|
||||
@ -576,8 +576,8 @@ These examples all incorrectly mix upper and lower case characters.
|
||||
|
||||
===Mathematical Companion===
|
||||
|
||||
Below we use the Bech32 character set to denote values in GF[32].
|
||||
In Bech32, the letter <code>Q</code> denotes zero and the letter <code>P</code> denotes one.
|
||||
Below we use the bech32 character set to denote values in GF[32].
|
||||
In bech32, the letter <code>Q</code> denotes zero and the letter <code>P</code> denotes one.
|
||||
The digits <code>0</code> and <code>2</code> through <code>9</code> do ''not'' denote their numeric values.
|
||||
They are simply elements of GF[32].
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user