Skip to content

Instantly share code, notes, and snippets.

@murchandamus
Last active December 14, 2019 02:27
Show Gist options
  • Save murchandamus/d9eeb10dfde769b2b6de52e379490bdb to your computer and use it in GitHub Desktop.
Save murchandamus/d9eeb10dfde769b2b6de52e379490bdb to your computer and use it in GitHub Desktop.
Test vectors for bech32 insertion/deletion weakness for 20 and 32 byte starting lengths
const bech32InsertionDeletionWeaknessTestVectors = [
[
// valid 32 byte bech32
'bc1qvfu057ptzatpxf30xc2yunuqad4dg54gkuvx04fuzch6gezltk2q63lcap',
// 33 byte with q insertion at second last position
'bc1qvfu057ptzatpxf30xc2yunuqad4dg54gkuvx04fuzch6gezltk2q63lcaqp'
],
[
// valid 32 byte bech32
'bc1ql6mqttdzpekxmdp9gaglvjtnfg4ydwzdtgcqxxru7f6m0eg9pckqnncqqp',
// 31 byte with qq deletion at second last position
'bc1ql6mqttdzpekxmdp9gaglvjtnfg4ydwzdtgcqxxru7f6m0eg9pckqnncp'
],
[
// valid 20 byte bech32
'bc1q6g6y8y62cgt7x3s2sdwax3nuur00uwcey570zp',
// 21 byte with qq insertion at second last position
'bc1q6g6y8y62cgt7x3s2sdwax3nuur00uwcey570zqqp'
],
[
// valid 20 byte bech32
'bc1q3qwt6j7yr9nzhskdh36eh6ktesy93ggwjfs9qp',
// 19 byte with q deletion at second last position
'bc1q3qwt6j7yr9nzhskdh36eh6ktesy93ggwjfs9p'
],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment