Custom fork of rust-bip39 with modifications for higher speed. Unsuitable for production.
Go to file
Michal Kucharczyk 33c3d131ef
Use rand crate re-exports when available
Re-exports from `rand` crate shall be used. Otherwise trait bounds in
`Mnemonic::generate_in_with` for `rand::thread_rng` object can get
unsatisfied if crate deps get ouf of sync.

This commit is fixing following errors:
```
error[E0277]: the trait bound `ThreadRng: rand_core::RngCore` is not satisfied
   --> /home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bip39-2.0.0/src/lib.rs:292:30
    |
292 |         Mnemonic::generate_in_with(&mut rand::thread_rng(), language, word_count)
    |         -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ the trait `rand_core::RngCore` is not implemented for `ThreadRng`
    |         |
    |         required by a bound introduced by this call
    |::
    = help: the following other types implement trait `rand_core::RngCore`:
...
note: required by a bound in `Mnemonic::generate_in_with`
   --> /home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bip39-2.0.0/src/lib.rs:266:6
    |
260 |     pub fn generate_in_with<R>(
    |            ---------------- required by a bound in this associated function
...
266 |         R: rand_core::RngCore + rand_core::CryptoRng,
    |            ^^^^^^^^^^^^^^^^^^ required by this bound in `Mnemonic::generate_in_with`

```

```
error[E0277]: the trait bound `ThreadRng: rand_core::CryptoRng` is not satisfied
   --> /home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bip39-2.0.0/src/lib.rs:292:30
    |
292 |         Mnemonic::generate_in_with(&mut rand::thread_rng(), language, word_count)
    |         -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ the trait `rand_core::CryptoRng` is not implemented for `ThreadRng`
    |         |
    |         required by a bound introduced by this call
    |
    = help: the following other types implement trait `rand_core::CryptoRng`:
...
note: required by a bound in `Mnemonic::generate_in_with`
   --> /home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bip39-2.0.0/src/lib.rs:266:27
    |
260 |     pub fn generate_in_with<R>(
    |            ---------------- required by a bound in this associated function
...
266 |         R: rand_core::RngCore + rand_core::CryptoRng,
    |                                 ^^^^^^^^^^^^^^^^^^^^ required by this bound in `Mnemonic::generate_in_with`

```

Co-authored-by: Tobin C. Harding <me@tobin.cc>
2024-02-10 12:16:03 +01:00
.github/workflows Add github actions files for CI 2023-02-27 21:16:26 +00:00
benches Add Portuguese language support 2023-10-13 15:05:49 -03:00
contrib Fix MSRV build and tests 2024-02-09 18:30:16 +00:00
src Use rand crate re-exports when available 2024-02-10 12:16:03 +01:00
.editorconfig Fix .editorconfig indent style 2023-03-13 11:46:34 +01:00
.gitignore First version, with static references 2020-06-07 00:46:54 +01:00
.rustfmt.toml Add .rustfmt.toml 2021-03-24 22:19:13 +00:00
CHANGELOG.md Update CHANGELOG and bump to v2.0.0 2023-02-27 21:24:00 +00:00
Cargo.toml Change hashes dep spec to >=0.12,<0.14 2024-01-29 18:42:19 +00:00
LICENSE First version, with static references 2020-06-07 00:46:54 +01:00
README.md readme: Inform user bitcoin_hashes needs to be pinned for MSRV 2024-02-09 18:32:38 +00:00

README.md

bip39

A Rust implementation of BIP-39 mnemonic codes.

Word lists (languages)

We support all languages specified in the BIP-39 standard as of writing.

The English language is always loaded and other languages can be loaded using the corresponding feature.

Use the all-languages feature to enable all languages.

  • English (always enabled)
  • Simplified Chinese (chinese-simplified)
  • Traditional Chinese (chinese-traditional)
  • Czech (czech)
  • French (french)
  • Italian (italian)
  • Japanese (japanese)
  • Korean (korean)
  • Portuguese (portuguese)
  • Spanish (spanish)

MSRV

This crate supports Rust v1.41.1 and up and works with no_std.

When using older version of Rust, you might have to pin the version of the bitcoin_hashes crate used as such:

$ cargo update --package "bitcoin_hashes" --precise "0.12.0"

If you enable the zeroize feature the MSRV becomes 1.51.