The current implementation parses the word list over and over again. Using lazy_static! we can do the operation only once and use it directly the next time the crate is used.
introduce to_entropy / to_entropy_hex
otherbip39implementations all feature the to_entropy call, which converts a mnemonic to the original entropy value. to_entropy_hex returns a hex formatted string of the entropy bytes.
Feedback about the API
Generally, I agree with #4 and the API for this crate should by different. Seed and MNemonic should be distinct types that can be initialized by calling ::from(String) or ::new, expose functions to convert between each other and and to/from entropy, as well as each providing their own .as_hex() etc. . This way using the create would be a lot easier and intuitive.
cache word list+word map using lazy_static!
The current implementation parses the word list over and over again. Using lazy_static! we can do the operation only once and use it directly the next time the crate is used.
introduce to_entropy / to_entropy_hex
other bip39 implementations all feature the
to_entropy
call, which converts a mnemonic to the original entropy value.to_entropy_hex
returns a hex formatted string of the entropy bytes.Feedback about the API
Generally, I agree with #4 and the API for this crate should by different.
Seed
andMNemonic
should be distinct types that can be initialized by calling::from(String)
or::new
, expose functions to convert between each other and and to/from entropy, as well as each providing their own.as_hex()
etc. . This way using the create would be a lot easier and intuitive.