I'm trying to understand Bitcoin address encodings. I understand there's three (four?) different address encodings P2PKH, P2SH, Bech32, and Bech32m (Bech32m just uses a different constant when XORing). They all encode the public key using Ripe160 (RIPEMD160?). I was able to use some libraries to extract the ripe160 encoded address, which should be 20 bytes, but there are some longer strings in this list of addresses with currency:
Bitcoin addresses with currency from loyce.com
34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo **bc1qgdjqv0av3q56jvd82tkdjpy7gdp9ut8tlqmgrpmv24sq90ecnvqqjwvw97** 1P5ZEDWTKTFGxQjZphgWPQUpe554WKDfHQ 37XuVSEpWW4trkfmvWzegTHQt7BdktSKUs 38UmuUqPCrFmQo4khkomQwZ4VbY2nZMJ67 3Kzh9qAqVWQhEsfQz7zEQL1EuSx5tyNLNS 1FeexV6bAHb8ybZjqQMjJrcCrHGW9sb6uF 3LYJfcfHPXYJreMsASk2jkn69LWEYKzexb bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6 1LdRcdxfbSnmCYYNdeYpUnztiYzVfBEQeC 1AC4fMwgY8j9onSbXEWeH6Zan8QGMSdmtA 1LruNZjwamWJXThX2Y8C2d47QqhAkkc5os 1NDyJtNTjmwk5xPNhjgAMu4HDHigtobu1s 3Gpex6g5FPmYWm26myFq7dW12ntd8zMcCY bc1q5shngj24323nsrmxv99st02na6srekfctt30ch 385cR5DM96n1HvBDMzLHPYcw89fZAXULJP 3LQUu4v9z6KNch71j7kbj8GPeAGUo1FW6a **bc1q5pucatprjrqltdp58f92mhqkfuvwpa43vhsjwpxlryude0plzyhqjkqazp** ... They start with bc1 so that indicates Bech32, correct? When decoding using something like bech32-buffer I get 32 bytes.
In doing some more digging, there's also this scriptPubKey encoding. Is that what these long encodings are? How do you differentiate them? I assume since the site is listing address with currency, I should be able to pull the ripe160 address from the script, are there any recommended parsers?
I found another post which suggests doing pattern matching, and pulling the parsing code from Bitcoin Core. Am I heading down the correct path here?