Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checksum length #156

Open
tcharding opened this issue Oct 26, 2023 · 3 comments
Open

Checksum length #156

tcharding opened this issue Oct 26, 2023 · 3 comments
Labels
1.0 Issues and PRs required or helping to stabilize the API

Comments

@tcharding
Copy link
Member

we should change the checksum length check so that we enforce it only on the data part, not the HRP or separator. (It appears that for segwit, the BIP says the 90 limit applies to the whole string.)

ref: #142 (comment)

@tcharding
Copy link
Member Author

So for segwit I believe we have it correct (assuming #142 merges) - 90 characters for the whole string as per BIP-173.

For lib.rs we use 1023, I thought this was based on what can be error detected so should it not include everything that goes into the checksum algorithm? If so this actually means 1023 is not correct because each character of the HRP feeds in two field elements to the checksum algo (high then low bits), right?

@apoelstra
Copy link
Member

If so this actually means 1023 is not correct because each character of the HRP feeds in two field elements to the checksum algo (high then low bits), right?

Yep, exactly.

My view is that the HRP should count for nothing, because if the HRP is wrong then you don't even know what checksum you're supposed to be using. But if we do count it, then we should be double-counting it.

@tcharding
Copy link
Member Author

Yep, exactly.

Do I get my white belt yellow tip in cryptography now?

@tcharding tcharding added the 1.0 Issues and PRs required or helping to stabilize the API label Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0 Issues and PRs required or helping to stabilize the API
Projects
None yet
Development

No branches or pull requests

2 participants