:: Re: [Libbitcoin] Newbie question --
Inizio della pagina
Delete this message
Reply to this message
Autore: Eric Voskuil
Data:  
To: Rich Paul
CC: libbitcoin
Oggetto: Re: [Libbitcoin] Newbie question --
Hi Rich,

BIP39 encoding does not round trip.

https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki

e

> On Aug 29, 2019, at 15:44, Rich Paul <rich.freeman.paul@???> wrote:
>
> I am trying to convert 256 bit key to words and back again.
>
> When I convert back, I get something that is not only completely different, but even a different size.
>
> Any suggestions?
>
> ------- ckey.cc
> #include <coinfwd.hh>
> #include <bitcoin/bitcoin.hpp>
> #include <algorithm>
> #include <cxxabi.h>
>
>
>
> using std::hex;
> using std::array;
>
> using namespace bc;
> using namespace std;
>
> ostream &operator<<(ostream &ostream, const ec_compressed &data) {
> return ostream << sizeof(data) << ": " << bc::encode_base16(data);
> };
> template<size_t _n>
> ostream &operator<<(ostream &ostream, const std::array<unsigned char,_n> &data) {
> return ostream << sizeof(data) << ": " << bc::encode_base16(data);
> };
> using libbitcoin::wallet::decode_mnemonic;
> int main(int, char**) {
> try {
> auto seed1 = base16_literal(
> "f3c8f9a6891cca98f481edde130cc031b1479a81e367b838fe9e0a9db0f5993d"
> );
>
> auto list    = bc::wallet::create_mnemonic(seed1);
> auto seed2 = decode_mnemonic(list);
> cout << "seed1: " << seed1 << endl;
> cout << "seed2: " << seed2 << endl;
> return 0;
> } catch ( const exception &ex ) {
> cerr << "exception: " << ex.what() << endl;
> } catch ( ... ) {
> cerr << "caught shit!" << endl;
> };
>   return 1;
> };
> ------------------  output
> seed1: 32: f3c8f9a6891cca98f481edde130cc031b1479a81e367b838fe9e0a9db0f5993d
> seed2: 64: ac43de3950b6e6064463d7649484ff7be9bfce9f456f05222445c6782cd12e053a0ba60ba73b5a555a4764bbd45f47e50c520d49bc08aae0088b4945784ee31b

>
> _______________________________________________
> Libbitcoin mailing list
> Libbitcoin@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/libbitcoin