TeachMeBitcoin

Bech32 Math (BCH Codes)

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

Bech32 Math: BCH Codes

While legacy addresses use hashing, modern SegWit addresses (bc1...) use a completely different mathematical approach called BCH (Bose-Chaudhuri-Hocquenghem) Codes. This method is similar to the technology used in QR codes and CDs to ensure data can be read even if it is slightly damaged.

1. Polynomial Division

Bech32 checksums are not hashes. Instead, they are the Remainder of a polynomial division.

2. Why is this better than Hashing?

Hashing is "Chaotic." If you change one character, the hash changes completely. This tells you that there is an error, but it doesn't tell you where.

3. The 6-Character Length

Bech32 uses a 6-character checksum (30 bits of data).

4. The Checksum Constant

In Bech32m (Taproot), the math is identical, but the final remainder is XOR'd with a different constant.

Feature Base58 (Hash) Bech32 (BCH)
Math SHA256 Hashing Polynomial Division
Error Location Impossible Possible
Transposition Check Random Mathematical Guarantee
Implementation Simple Complex

In the next section, we will analyze the Probability of Failure.

☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!