Steven Roose
5dcdac9c74
Fix MSRV build and tests
2024-02-09 18:30:16 +00:00
Steven Roose
37915dc0ae
Merge pull request #60 from kayabaNerve/master
...
bitcoin_hashes >= 0.12, <= 0.13
2024-01-30 01:41:52 +07:00
Steven Roose
b11619d72a
Merge pull request #62 from pezcore/feature/checksum
...
Add interface to expose the mnemonic checksum
2024-01-30 01:37:21 +07:00
Steven Roose
8bf5b20629
Add unit test to check ordering of supposedly ordered word lists
2024-01-29 18:33:42 +00:00
Steven Roose
d8b046da28
Replace unreachable_patterns tag with explicit feature use
2024-01-29 18:33:40 +00:00
pezcore
51fd048e86
feat: optimize impl of Language::find_word
...
For languages that support it, the implementation of
`Language::find_word` now uses binary search to find the word index. For
languages that do not support it, the old linear search is used.
This substantially improves the runtime performance of
`Language::find_word`. For affected languages, average lookup rate is
increased ~25x on release builds and ~100x on debug builds.
2024-01-29 18:33:39 +00:00
Marko Bencun
c02046c031
fix some important std unit tests that were not running due to typo
...
`#[cfg(features = "std")]` is invalid and always disabled the whole block.
2024-01-29 18:16:49 +00:00
pezcore
778527cd4f
feat: add checksum interface for Mnemonic
2024-01-25 21:11:07 -05:00
Luke Parker
256a00e7c2
bitcoin_hashes >= 0.12, <= 0.13
2023-11-27 23:07:42 -05:00
Steven Roose
a7649ae740
Merge pull request #50 from Foundation-Devices/jeandudey/iter
...
Iterator improvements
2023-10-19 09:53:55 -04:00
Rafael Lemos
75d4f0c559
Add Portuguese language support
2023-10-13 15:05:49 -03:00
Jean-Pierre De Jesus DIAZ
0b92d8db6c
Add iterator over word indices.
...
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-09-20 13:09:22 +02:00
Jean-Pierre De Jesus DIAZ
73f0c112aa
Add words and deprecate word_iter method
...
To follow the convention for Rust iterators, for example, in `str`
the method for a char iterator is `chars` not `char_iter`.
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-09-20 13:05:20 +02:00
Steven Roose
d93a017ec3
Merge pull request #51 from Foundation-Devices/jeandudey/docs
...
Fix typo and remove extern crate in documentation
2023-08-27 20:31:14 -05:00
pezcore
53090ea50d
doc: fix reference to Vec<u8>
2023-03-24 13:26:27 -04:00
pezcore
36fc016a16
Make reference to source BIP a hyperlink
2023-03-24 13:26:10 -04:00
pezcore
c7ae12fb64
doc: enable documentation of feature-gated items in docsrs
2023-03-24 13:22:53 -04:00
Jean-Pierre De Jesus DIAZ
795574e73b
Remove extern crate from examples documentation
...
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-03-13 12:13:01 +01:00
Jean-Pierre De Jesus DIAZ
a0bb29c05e
Fix typo in variable documentation
...
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-03-13 12:12:39 +01:00
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