micro-bitcoin / uBitcoin

Bitcoin library for microcontrollers. Supports Arduino, mbed, bare metal.
https://micro-bitcoin.github.io/
MIT License
166 stars 34 forks source link

Different mnemonic from the same entropy #11

Closed phplego closed 3 years ago

phplego commented 3 years ago

I'm trying to generate mnemonic using string with entropy bytes. I've noticed that sometimes I get different results with the same entropy string. For example this code:

            String mnemonic = generateMnemonic("1");
            Serial.println(mnemonic);

The first time it prints:

country abandon abandon abandon abandon about cage legend lift system charge gossip maze work yellow avoid will wife among wait useless abandon advance trend

The second (and following) times it prints:

country abandon abandon abandon abandon abandon abandon abandon lift system charge gossip maze work yellow avoid will wife among wait useless abandon advance tree

How is it possible? Is it bug of feature? Thanks.

stepansnigirev commented 3 years ago

Thanks for reporting! Fixed in https://github.com/micro-bitcoin/uBitcoin/commit/c5db85cb8bdd897c25be1c654c3c77b1a320cb1f