In want to make sure I understood Extended Wallet Import Format (which is what BIP178 proposes and a couple of Electrum versions used as defaulted), also have some data for unit testing.
hex: 0c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d [1]
P2PKH: KwdMAjGmerYanjeui5SHS7JkmpZvVipYvB2LJGU1ZxJwYx2CqY6c
P2WPKH: KwdMAjGmerYanjeui5SHS7JkmpZvVipYvB2LJGU1ZxJwYxCGTuAe
P2WPKH_P2SH: KwdMAjGmerYanjeui5SHS7JkmpZvVipYvB2LJGU1ZxJwYxGoTEdc
Note that above is only the BIP178 proposal which is not what Electrum is using. Electrum Extended WIFs will look like these:
hex: 0c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d
P2WPKH: L6Cyjtdfq1TimFfgG9qBEHQF2FmaL96H5ceTrip74S4eqFapbcDJ
P2WPKH_P2SH: LEncK3za1ANrjmgSpEE52TVjGgyEAZN1F4GbRBACYupN7ao1BVeh
P2SH: LgXW2Y5GXd8GfKikUTQkQynC1zaBfpBBjP8z6YCV2M5VxaMBQ5C1
P2WSH: Lq78bhSAhn3QdqjX2XoeD9sgGRmqWESutpm7ezYaWpqDEuYfi2Sc
P2WSH_P2SH: LygmAro4svxYcMkHacCY1KyAWryVLeie4GPFDStg1JavXEn8H9X5
I can't find any test vectors to use so I need verification for these. And c++ has never made any sense to me [2]! So I can't really tell how that PR is tested.
P.S. Is BIP178[3] missing bytes P2SH, P2WSH and P2WSH_P2SH and are they 0x13, 0x14 and 0x15 respectively?
[1]
https://en.bitcoin.it/wiki/Wallet_import_format[2]
https://github.com/bitcoin/bitcoin/pull/12869/files[3]
https://github.com/bitcoin/bips/blob/master/bip-0178.mediawiki