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

Add C# reference implementation #20

Closed
wants to merge 1 commit into from

Conversation

NicolasDorier
Copy link

Implement Bech32 with error detection in C#.

@NicolasDorier
Copy link
Author

@sipa can you merge that ?


private static byte[] Scriptpubkey(byte witver, byte[] witprog)
{
var v = witver > 0 ? witver + 0x80 : 0;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/80/50, see #23

@NicolasDorier
Copy link
Author

Updated and fixed the tests

@NicolasDorier
Copy link
Author

Anything left for merging ?

@sipa
Copy link
Owner

sipa commented Sep 18, 2017

@NicolasDorier Sorry for the slow response here...

I would rather avoid having the full error location logic in the reference implementation (which is intended to be lean and understandable, and easily copy-pastable and into your own project). There is a separate ecc directory for the error correction code.

@NicolasDorier
Copy link
Author

Removed code error correction code

@P33LLo
Copy link

P33LLo commented Jan 26, 2018

Pay P33LL0

return chk;
}

bool VerifyChecksum(byte[] data, int bechStringLen)
Copy link

@Coding-Enthusiast Coding-Enthusiast Jan 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bechStringLen is never used.

throw new FormatException("bech chars are out of range");
}

buffer = Encoding.ASCII.GetBytes(encoded);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nitpicking) buffer is already set in line 315

@NicolasDorier
Copy link
Author

Thanks @Coding-Enthusiast , fixed.

@NicolasDorier
Copy link
Author

@sipa do you intend to merge this one day?

@NicolasDorier
Copy link
Author

Spring cleaning, ping me if you feel like merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants