-
Notifications
You must be signed in to change notification settings - Fork 106
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
Conversation
@sipa can you merge that ? |
ref/csharp/Program.cs
Outdated
|
||
private static byte[] Scriptpubkey(byte witver, byte[] witprog) | ||
{ | ||
var v = witver > 0 ? witver + 0x80 : 0; |
There was a problem hiding this comment.
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
cc505ce
to
03edfbd
Compare
Updated and fixed the tests |
Anything left for merging ? |
@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. |
03edfbd
to
26feece
Compare
Removed code error correction code |
Pay P33LL0 |
ref/csharp/Bech32Encoder.cs
Outdated
return chk; | ||
} | ||
|
||
bool VerifyChecksum(byte[] data, int bechStringLen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bechStringLen
is never used.
ref/csharp/Bech32Encoder.cs
Outdated
throw new FormatException("bech chars are out of range"); | ||
} | ||
|
||
buffer = Encoding.ASCII.GetBytes(encoded); |
There was a problem hiding this comment.
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
Thanks @Coding-Enthusiast , fixed. |
@sipa do you intend to merge this one day? |
Spring cleaning, ping me if you feel like merging. |
Implement Bech32 with error detection in C#.