Giter Site home page Giter Site logo

tiny-bip39's Introduction

tiny-bip39

Travis shield Crates.io version shield Crates.io license shield

This is a fork of the bip39 crate with fixes for v0.6.

Changes

See the releases for changes since the fork.

This crate supports multiple languages, all are enabled by default, you can choose to specify them with feature flags:

  • chinese-simplified
  • chinese-traditional
  • french
  • italian
  • japanese
  • korean
  • spanish

English is always enabled.

tiny-bip39's People

Contributors

dingxiangfei2009 avatar dusty-phillips avatar ia0 avatar jasondavies avatar karbyshev avatar llfourn avatar maciejhirsz avatar meh avatar michalkucharczyk avatar questofiranon avatar realbigsean avatar remoun avatar rob-solana avatar steveatinfincia avatar therustmonk avatar tomtau avatar wigy-opensource-developer avatar yannleretaille avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tiny-bip39's Issues

Request for 1.0.1 release

What's the preferred process for incorporating the work in Pull Request #42 into the official release (1.0.1)? Should I initiate a Pull Request with a version bump?

[bug] Invalid checksum errors on valid phrases

Hello!
I generated the following mnemonic:
boost then machine pluck main scorpion garden law gift obscure beauty mother
then tried to use Mnemonic::from_phrase to get the mnemonic type, but 4/5 times I get a bad checksum error.

Can not compile 0.8.0

Hi, I'm getting the following error when trying to compile v0.8.0.
I've made a new Cargo.toml and have only this for the deps:

[dependencies]
tiny-bip39 = "0.8.0"
$ cargo build
   Compiling tiny-bip39 v0.8.0
error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor
   --> /home/parazyd/.cargo/registry/src/github.com-1ecc6299db9ec823/tiny-bip39-0.8.0/src/language.rs:116:24
    |
116 | #[derive(Debug, Clone, Copy, PartialEq, Zeroize)]
    |                        ^^^^ Copy not allowed on types with destructors
    |
    = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0184`.
error: could not compile `tiny-bip39` due to previous error

Rust/Cargo version is 1.55.0-nightly.

Rust crate gives different mnemonic derivation to the offical JS bip39 package

Looking into the code the difference seems to be that the JS bip39 package uses:

const mnemonicBuffer = Buffer.from(normalize(mnemonic), 'utf8');

Whereas the Rust package uses the JS packages's conversionToEntropy logic (in the Rust package this is phrase_to_entropy) before proceeding with the derivation:

let mut bits = BitWriter::with_capacity(264);
for word in phrase.split(" ") {
    bits.push(wordmap.get_bits(&word)?);
}
let mtype = MnemonicType::for_word_count(bits.len() / 11)?;
let mut entropy = bits.into_bytes();
let entropy_bytes = mtype.entropy_bits() / 8;
entropy.truncate(entropy_bytes);

The results of both operations with the same phrase is different.

There can only be one correct implementation of bip39, so which package is incorrect?

Remove `anyhow` and return ErrorKind errors

I am working on a cli bitcoin wallet project that is using tiny-bip39 and I've found that in order to handle error results from tiny-bip39 I need to map_err() and downcast() them from anyhow::Error.

My understanding is that anyhow isn't really meant to be used in libs which should return their own custom errors (possibly enhanced with thiserror as you do).

https://github.com/dtolnay/anyhow#comparison-to-thiserror

Would this project be open to removing anyhow and just returning your own custom error enum values in your function results ? If so I'm happy to work on a PR.

Many E0658 errors

  --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:35:1
   |
35 | pub extern crate alloc;
   | ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: add #![feature(alloc)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
  --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:49:5
   |
49 | use core::mem::MaybeUninit;
   |     ^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:294:12
    |
294 |     Inline(MaybeUninit<A>),
    |            ^^^^^^^^^^^^^^
    |
    = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:315:28
    |
315 |     fn from_inline(inline: MaybeUninit<A>) -> SmallVecData<A> {
    |                            ^^^^^^^^^^^^^^
    |
    = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:319:36
    |
319 |     unsafe fn into_inline(self) -> MaybeUninit<A> {
    |                                    ^^^^^^^^^^^^^^
    |
    = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:394:45
    |
394 |             data: SmallVecData::from_inline(MaybeUninit::uninit()),
    |                                             ^^^^^^^^^^^^^^^^^^^
    |
    = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:434:63
    |
434 |                 let mut data = SmallVecData::<A>::from_inline(MaybeUninit::uninit());
    |                                                               ^^^^^^^^^^^^^^^^^^^
    |
    = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:470:45
    |
470 |             data: SmallVecData::from_inline(MaybeUninit::new(buf)),
    |                                             ^^^^^^^^^^^^^^^^
    |
    = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:489:55
    |
489 |         unsafe { SmallVec::from_buf_and_len_unchecked(MaybeUninit::new(buf), len) }
    |                                                       ^^^^^^^^^^^^^^^^
    |
    = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:508:51
    |
508 |     pub unsafe fn from_buf_and_len_unchecked(buf: MaybeUninit<A>, len: usize) -> SmallVec<A> {
    |                                                   ^^^^^^^^^^^^^^
    |
    = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:670:55
    |
670 |                 self.data = SmallVecData::from_inline(MaybeUninit::uninit());
    |                                                       ^^^^^^^^^^^^^^^^^^^
    |
    = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:737:55
    |
737 |                 self.data = SmallVecData::from_inline(MaybeUninit::uninit());
    |                                                       ^^^^^^^^^^^^^^^^^^^
    |
    = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
    --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:1078:52
     |
1078 |                     let mut data: MaybeUninit<A> = MaybeUninit::uninit();
     |                                                    ^^^^^^^^^^^^^^^^^^^
     |
     = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
    --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:1078:35
     |
1078 |                     let mut data: MaybeUninit<A> = MaybeUninit::uninit();
     |                                   ^^^^^^^^^^^^^^
     |
     = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:303:42
    |
303 |             SmallVecData::Inline(a) => a.as_ptr() as *const A::Item,
    |                                          ^^^^^^
    |
    = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:310:42
    |
310 |             SmallVecData::Inline(a) => a.as_mut_ptr() as *mut A::Item,
    |                                          ^^^^^^^^^^
    |
    = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0599]: no function or associated item named `uninit` found for type `core::mem::MaybeUninit<_>` in the current scope
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:394:58
    |
394 |             data: SmallVecData::from_inline(MaybeUninit::uninit()),
    |                                             -------------^^^^^^
    |                                             |
    |                                             function or associated item not found in `core::mem::MaybeUninit<_>`

error[E0599]: no function or associated item named `uninit` found for type `core::mem::MaybeUninit<_>` in the current scope
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:434:76
    |
434 |                 let mut data = SmallVecData::<A>::from_inline(MaybeUninit::uninit());
    |                                                               -------------^^^^^^
    |                                                               |
    |                                                               function or associated item not found in `core::mem::MaybeUninit<_>`

error[E0599]: no function or associated item named `uninit` found for type `core::mem::MaybeUninit<_>` in the current scope
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:670:68
    |
670 |                 self.data = SmallVecData::from_inline(MaybeUninit::uninit());
    |                                                       -------------^^^^^^
    |                                                       |
    |                                                       function or associated item not found in `core::mem::MaybeUninit<_>`

error[E0658]: use of unstable library feature 'try_from' (see issue #33417)
  --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\rustc-hash-1.1.0\src\lib.rs:31:5
   |
31 | use core::convert::TryInto;
   |     ^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: add #![feature(try_from)] to the crate attributes to enable

error[E0599]: no function or associated item named `uninit` found for type `core::mem::MaybeUninit<_>` in the current scope
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:737:68
    |
737 |                 self.data = SmallVecData::from_inline(MaybeUninit::uninit());
    |                                                       -------------^^^^^^
    |                                                       |
    |                                                       function or associated item not found in `core::mem::MaybeUninit<_>`

error[E0599]: no method named `assume_init` found for type `core::mem::MaybeUninit<A>` in the current scope
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:916:39
    |
916 |                 Ok(data.into_inline().assume_init())
    |                                       ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'try_from' (see issue #33417)
  --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\rustc-hash-1.1.0\src\lib.rs:89:71
   |
89 |         let read_usize = |bytes: &[u8]| u64::from_ne_bytes(bytes[..8].try_into().unwrap());
   |                                                                       ^^^^^^^^
   |
   = help: add #![feature(try_from)] to the crate attributes to enable

error[E0599]: no function or associated item named `uninit` found for type `core::mem::MaybeUninit<_>` in the current scope
    --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:1078:65
     |
1078 |                     let mut data: MaybeUninit<A> = MaybeUninit::uninit();
     |                                                    -------------^^^^^^
     |                                                    |
     |                                                    function or associated item not found in `core::mem::MaybeUninit<_>`

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
    --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\smallvec-1.2.0\lib.rs:1081:30
     |
1081 |                         data.as_mut_ptr() as *mut A::Item,
     |                              ^^^^^^^^^^
     |
     = help: add #![feature(maybe_uninit)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'try_from' (see issue #33417)
  --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\rustc-hash-1.1.0\src\lib.rs:98:60
   |
98 |             hash.add_to_hash(u32::from_ne_bytes(bytes[..4].try_into().unwrap()) as usize);
   |                                                            ^^^^^^^^
   |
   = help: add #![feature(try_from)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'try_from' (see issue #33417)
   --> C:\Users\m\.cargo\registry\src\github.com-1ecc6299db9ec823\rustc-hash-1.1.0\src\lib.rs:102:60
    |
102 |             hash.add_to_hash(u16::from_ne_bytes(bytes[..2].try_into().unwrap()) as usize);
    |                                                            ^^^^^^^^
    |
    = help: add #![feature(try_from)] to the crate attributes to enable

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
error: aborting due to 23 previous errors

Some errors occurred: E0599, E0658.
For more information about an error, try `rustc --explain E0599`.
error: Could not compile `smallvec`.
warning: build failed, waiting for other jobs to finish...
error: Could not compile `rustc-hash`.
warning: build failed, waiting for other jobs to finish...
error: build failed```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.