Steven Roose
8e6ba6de9b
Make rand_core optional and expose rand and rand_core crates
2023-02-27 21:23:57 +00:00
Steven Roose
ca53ee34a8
Make serde usable in no_std
2023-02-27 21:16:24 +00:00
Steven Roose
d3c96b1448
Rename new method to Mnemonic::parse_in_normalized_without_checksum_check
...
This is according with the other methods in the API.
2023-02-26 18:36:34 +00:00
Steven Roose
6b79d78c80
Make normalize_utf8_cow public
2023-02-26 18:36:09 +00:00
Ayrat Badykov
38f81b87d7
Parse a mnemonic without checksum check
...
In some situations, a user can come with mnemonic words himself. In
this case a mnemonic will fail the checksum check.
This pr implements a function to be able to parse a mnemonic without
checksum check
2023-02-26 08:23:52 +02:00
pezcore
593f4767f4
fix: Disply for Error::BadWordCount
...
This Display description of the BadWordCount variant incorrectly
complained stated that the word count is not a multiple of 6. The
correct criteria for valid word counts is now that it must be a multiple
of 3 between 12 and 24 inclusive, so the Display impl is fixed to be
more precise.
2023-01-28 16:26:43 -05:00
pezcore
03dbb973cb
Fix Mnemonic documentation for supported wordcounts
2022-10-25 21:57:52 -04:00
Steven Roose
00d628f1a8
Merge pull request #13 from praveenperera/zeroize-support
...
Add optional zeroize support
2022-06-29 17:44:15 +01:00
trevyn
30290800eb
Remove "We currently don't implement seed generation from the phrase."
...
This shows up prominently at https://docs.rs/bip39/1.0.1/bip39/index.html , but it appears that seed generation is indeed implemented in the `to_seed()` method.
2022-06-05 11:51:52 -04:00
Praveen Perera
e409dc2481
Replace deprecated `zeroize(drop)` with trait
2022-05-13 10:39:49 -04:00
Steven Roose
da090d223a
Merge pull request #20 from Dr-Julius-No/master
...
Make word list public; addresses #19
2022-05-13 13:48:52 +01:00
Dr. No
f01e0b2de4
Make word list public; addresses #19
2022-03-01 23:29:05 -05:00
Tobin Harding
af958a253a
Add unit test for valid word counts
...
We just enabled word counts of 15, add a unit test that verifies all the
valid word count values.
2021-11-10 09:17:15 +11:00
Tobin Harding
60144920f3
Allow word count multiples of 3 instead of 6
...
BIP39 says
> The allowed size of ENT is 128-256 bits.
Once we add the checksum this is 132-264 bits. This is divided by 11 to
get the word count. From the BIP141
```
CS = ENT / 32
MS = (ENT + CS) / 11
| ENT | CS | ENT+CS | MS |
+-------+----+--------+------+
| 128 | 4 | 132 | 12 |
| 160 | 5 | 165 | 15 |
| 192 | 6 | 198 | 18 |
| 224 | 7 | 231 | 21 |
| 256 | 8 | 264 | 24 |
```
Currently we are limiting word count to be a multiple of 6, I do not
know why this is being done but from reading the BIP it seems that 15 is
a valid word count value.
Allow word count of 15 by checking the word count modulo 3 instead of
modulo 6. Since this check appears twice in the code, add a helper
function to reduce code duplication.
Fixes : #15
2021-11-10 09:17:14 +11:00
Praveen Perera
bb0f63298a
Use `zeroize_derive` feature instead of impl zeroize
2021-04-19 12:08:04 -04:00
Praveen Perera
a298344178
Add optional zeroize support
2021-04-19 11:49:43 -04:00
Steven Roose
88819a0882
Make Mnemonic::language_of public
2021-04-01 14:57:57 +01:00
Steven Roose
3994ee95b0
Add Mnemonic::language getter
2021-04-01 14:56:25 +01:00
Steven Roose
63d3eab009
Use indices internally instead of &'static str
2021-04-01 14:51:09 +01:00
Steven Roose
b8ea0b86bf
Apply rustfmt
...
Excluding the language files
2021-03-24 22:19:26 +00:00
Steven Roose
04e139ca27
Add generate doctests
2021-03-24 19:25:15 +00:00
Steven Roose
0313e97134
Remove core feature
2021-03-24 19:02:35 +00:00
Steven Roose
5fe9d2b094
Only pass actual mnemonic into pbkdf2
2021-03-24 18:39:43 +00:00
Steven Roose
44397cc255
Remove pointless debug_assert
2021-03-24 18:39:42 +00:00
Steven Roose
8b3e901b35
Add a generation method that doesn't need rand
2021-03-24 18:39:40 +00:00
Steven Roose
ca454327b2
Differentiate std and core
2021-03-24 18:39:39 +00:00
Steven Roose
d41e0722dc
Simplify language selection
2021-03-24 16:39:53 +00:00
Steven Roose
1f1d761930
Add support for `Mnemonic::to_entropy_array` for no-std
2021-03-08 11:18:39 +00:00
Steven Roose
116b508cd3
Add word information to Error::UnknownWord
2021-03-08 11:18:37 +00:00
Steven Roose
7836707810
Fix MIN_NB_WORDS
2021-03-08 11:18:35 +00:00
Steven Roose
125a287a05
Improve Mnemonic::language_of
2021-03-08 11:18:34 +00:00
Steven Roose
7771fd8244
Two typos
2021-03-08 11:18:33 +00:00
Steven Roose
da84fd8164
Improve slightly on the Error::AmbiguousLanguages
2021-03-08 11:18:32 +00:00
Steven Roose
e44e4b27d8
Clarify some constants in from_entropy_in
2021-03-08 11:18:29 +00:00
Steven Roose
14495917ca
Refactor to make std optional
2021-02-01 11:58:01 +01:00
Steven Roose
2631c60a5a
Implement serde serialization
2020-10-08 15:00:35 +02:00
Steven Roose
6278a2095a
Return an array for Mnemonic::to_seed
...
Instead of a fixed-size Vec.
2020-10-08 14:44:47 +02:00
Steven Roose
dd72aadfdb
Small optimization when only a single language is enabled
2020-10-08 14:44:46 +02:00
Steven Roose
077d594aca
Move Mnemonic::parse_in above Mnemonic::parse
2020-10-08 14:44:45 +02:00
Steven Roose
cb9d5f91d8
Avoid some unnecessary allocations
2020-10-08 14:44:43 +02:00
Steven Roose
bc452184dc
Fix refs to types in docs
2020-09-22 12:34:45 +02:00
Steven Roose
dc4c9999ea
Add MAX_NB_WORDS
2020-09-22 12:34:26 +02:00
Steven Roose
75b8e06f6a
Remove Display-based fmt::Debug impl
2020-09-22 12:33:00 +02:00
Steven Roose
81ba8b957f
Remove unused IDEAGRAPHIC_SPACE
2020-09-22 12:32:35 +02:00
Steven Roose
de52b3679f
Style nits in words_overlaps test
2020-07-20 14:07:11 +02:00
Steven Roose
0ecb12d399
Fix Mnemonic::language_of docs
2020-07-20 13:57:28 +02:00
Steven Roose
dabbdce4d5
Fix nit in bit count support and add test for that
2020-07-20 13:47:19 +02:00
Steven Roose
32daa49834
Add awareness of uniqueness of words in wors lists
...
This is needed to have good guarantees for the
Mnemonic::guess_language method which can therefore
be renamed to Mnemonic::language_of.
2020-07-18 14:06:16 +02:00
Yancy Ribbens
57c79a33cd
Add entropy bounds check
2020-07-12 10:31:34 -05:00
Steven Roose
988f99309f
Spell word list with a space
2020-06-19 11:57:38 +01:00