Skip to content

Decode a Base58 string of ones as that many zero bytes - #520

Open
SashaMIT wants to merge 1 commit into
arthurdejong:masterfrom
SashaMIT:fix/base58-zero
Open

SashaMIT wants to merge 1 commit into
arthurdejong:masterfrom
SashaMIT:fix/base58-zero

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 3, 2026 •

Copy link
Copy Markdown

Summary

  • b58decode('1') returned two zero bytes. The digit 1 is zero, and each leading 1 is already a zero byte, so packing the leftover 0 added one extra.
  • b58decode('11') is now two zero bytes. b58decode('2') is still b'\x01'. b58decode('') is now empty.
  • validate('1NEDqZPvTWRaoho48qXuLLsrYomMXPABfD') is still that address. validate('1111111111111111111114oLvT2') is still that address.

Test plan

  • pytest --doctest-modules stdnum/bitcoin.py tests/test_bitcoin.doctest

The digit 1 is zero, and each leading 1 is already a zero byte. Packing the leftover 0 added one extra byte, so '1' decoded as two zero bytes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant