Add support for abbreviated bip39 mnemonic elements #91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's a simple set of changes that allow for the support of 4 (and greater) character bip39 mnemonic elements. It does this by implementing a uft8_strncmp() function that tries to account for utf8 multibyte characters (counting characters encoded in multiple bytes as a single character). Some characters are actually composed of two characters - for example in Hiragana (Japanese) sounds mark characters can be added to a preceding character - in which case only a single character should be counted. In any case, the utf8_strncmp() function should work on the character sets supported by libwally-core as of this PR but might need to be updated of other character sets are added.
One caveat with these changes is that it assumes that wordlist is only intended to handle 4 significant character words. If it's intended to be more general then the number of significant characters should be parameterized.
May resolve #89