(Some of) the math behind Bech32 addresses

Samuel Dobson
Sep 2 · 17 min read

Mathematical background

Finite fields

Polynomials

Base 32

Converting bits to characters and back

Base32 character conversion table from BIP 173

BCH codes

How PolyMod works

Bech32

Creating a checksum

Verifying a checksum

Encoding and decoding

Cool/useful links

Samuel Dobson

Written by

Bitcoin Core wallet maintainer | Cryptography PhD student | http://keybase.io/meshcollider

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade