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

improve Bech32 encode / decode #15

Open
tweakch opened this issue Jul 29, 2021 · 1 comment
Open

improve Bech32 encode / decode #15

tweakch opened this issue Jul 29, 2021 · 1 comment

Comments

@tweakch
Copy link
Collaborator

tweakch commented Jul 29, 2021

just a backing issue for future improvement

private byte[] ConvertBits(byte[] data, int fromBits, int toBits, bool pad = true)
{
// TODO: Optimize Looping
// We can use a method similar to BIP39 here to avoid the nested loop, usage of List, increase the speed,
// and shorten this function to 3 lines.
// Or convert to ulong[], loop through it (3 times) take 5 bits at a time or 8 bits at a time...

Maybe the implementations of System.Convert.ToBase64String() and/or Base32 can give a hint on how to improve this method

That said, keeping it clsoe to the reference implementations of BIP32 is a good idea

@nothingalike
Copy link
Member

@tweakch
status of this issue?

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

No branches or pull requests

2 participants