Bitcoin Forum
December 12, 2024, 02:05:06 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: C# - From hexadecimal to mnemonic?  (Read 305 times)
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1736
Merit: 8448


Fiatheist


View Profile WWW
November 29, 2020, 11:40:04 AM
 #1

I've read how an mnemonic works. Basically the program takes parts of the hex that represent a number between 0 and 2047 and it prints words from a txt file that correspond to the analogous numbers of their file line. I've also seen that there are many libraries in which you can create mnemonics with just a command.

On C#'s NBitcoin for example you can with
Code:
Mnemonic mnemo = new Mnemonic(Wordlist.English, WordCount.Twelve);

What I want to do is converting a hex (128-bit or 256-bit) into mnemonic. I have found ways to do that, but only from other programming languages' libraries. I want to do it on C# and because I'm a little afraid of implementing this into code for the first time, I would like to know if there is already a simple way to do that.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1043
Merit: 2824


Bitcoin and C♯ Enthusiast


View Profile WWW
November 29, 2020, 01:53:59 PM
Merited by Rath_ (3), OmegaStarScream (2), ABCbits (1), Heisenberg_Hunter (1)
 #2

The conversion is pretty simple and straight forward. As you already know you treat the entropy (your hex) as an octet string and have to select 11 bits at a time. It appears that NBitcoin uses .net's BitArray class which I find very inefficient way of working with bits so I simply put the bits with the padding in a uint[] and then select the bits from there. You can see it here with sufficient comments.

What you want can be achieved from the following single line method:
Code:
using Autarkysoft.Bitcoin.Encoders;
using Autarkysoft.Bitcoin.ImprovementProposals;

public BIP0039 GetBip39FromHex(string hex) => new BIP0039(Base16.Decode(hex));

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.20.0)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1736
Merit: 8448


Fiatheist


View Profile WWW
November 29, 2020, 01:59:13 PM
Last edit: November 30, 2020, 10:24:00 AM by BlackHatCoiner
 #3

I guess that Autarkysoft.Bitcoin is one of your projects. Unfortunately, it seems that I can't install it. (Visual studio 2017 on windows 10)

Quote
Attempting to gather dependency information for package 'Autarkysoft.Bitcoin.0.6.1' with respect to project 'Mnemonic keys', targeting '.NETFramework,Version=v4.6.1'
Gathering dependency information took 20.43 ms
Attempting to resolve dependencies for package 'Autarkysoft.Bitcoin.0.6.1' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Autarkysoft.Bitcoin.0.6.1'
Resolved actions to install package 'Autarkysoft.Bitcoin.0.6.1'
Retrieving package 'Autarkysoft.Bitcoin 0.6.1' from 'nuget.org'.
Install failed. Rolling back...
Package 'Autarkysoft.Bitcoin.0.6.1' does not exist in project 'Mnemonic keys'
Package 'Autarkysoft.Bitcoin.0.6.1' does not exist in folder 'C:\Users\bymet\source\repos\Mnemonic keys\packages'
Executing nuget actions took 707.17 ms
Could not install package 'Autarkysoft.Bitcoin 0.6.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Time Elapsed: 00:00:00.8753458
========== Finished ==========

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1043
Merit: 2824


Bitcoin and C♯ Enthusiast


View Profile WWW
November 29, 2020, 02:25:54 PM
 #4

I guess that Autarkysoft.Bitcoin is one of your projects.
Yes it is, you can find it in my signature too. Keep in mind that the library is in beta and you can find my versioning convention here

Quote
Unfortunately, it seems that I can't install it. (Visual studio 2017 on windows 10)
This is a known bug with old visual studio, it will be fixed if you upgrade to VS2019. Until then check out this SE reply which should help.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.20.0)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1736
Merit: 8448


Fiatheist


View Profile WWW
November 29, 2020, 03:14:56 PM
 #5

I just installed VS2019 and got a similar error:
Quote
Could not install package 'Autarkysoft.Bitcoin 0.6.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.            

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1043
Merit: 2824


Bitcoin and C♯ Enthusiast


View Profile WWW
November 29, 2020, 03:39:40 PM
 #6

That error is because .net standard 2.1 (the library's target framework) is not compatible with the very old .net framework 4.7.2, you should upgrade to .net core 3.0+ (3.1 is LTS). See this table on MSDN.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.20.0)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1736
Merit: 8448


Fiatheist


View Profile WWW
November 29, 2020, 04:07:54 PM
 #7

That error is because .net standard 2.1 (the library's target framework) is not compatible with the very old .net framework 4.7.2, you should upgrade to .net core 3.0+ (3.1 is LTS). See this table on MSDN.
I upgraded to 3, then I tried to install your library, same error. I upgraded to 5, then I tried to install your library, same error again. I cleared the nuget cache as this guy says here, still nothing. I wonder what's the fault.

Should I download .net framework 4.8?

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1043
Merit: 2824


Bitcoin and C♯ Enthusiast


View Profile WWW
November 29, 2020, 04:40:22 PM
 #8

I upgraded to 3, then I tried to install your library, same error.
If you get the "same error" saying "...into a project that targets '.NETFramework,Version=v4.7.2',..." it means you have not changed your target framework. Go to your project properties (select the project from solution explorer then from menu Project > {project name} properties) then in Application tab you should see a Target framework combobox where you can select the available frameworks. You can also manually modify your .csproj file if you are familiar with it, I'm already using the package in another project of mine targeting netcoreapp3.1 like this:
https://github.com/Coding-Enthusiast/FinderOuter/blob/b35b843987541dac24f8577342d287fd49f9dad7/Src/FinderOuter/FinderOuter.csproj#L58

Should I download .net framework 4.8?
No version of .net framework would work, they are kind of obsolete. There are certain improvements that were added to .net core and are present only in .net standard 2.1 which I'm taking advantage of in the library, so you have to target .net core 3.0+.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.20.0)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1736
Merit: 8448


Fiatheist


View Profile WWW
November 29, 2020, 05:53:29 PM
 #9

If you get the "same error" saying "...into a project that targets '.NETFramework,Version=v4.7.2',..." it means you have not changed your target framework. Go to your project properties (select the project from solution explorer then from menu Project > {project name} properties) then in Application tab you should see a Target framework combobox where you can select the available frameworks.
And choose what framework? I was on 4.7.2, it has 2.0, 3.0 etc. I changed it to 3.0, then tried to install, same error.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1043
Merit: 2824


Bitcoin and C♯ Enthusiast


View Profile WWW
November 29, 2020, 06:53:45 PM
 #10

And choose what framework? I was on 4.7.2, it has 2.0, 3.0 etc. I changed it to 3.0, then tried to install, same error.
Are you sure you set it to .net core 3.0 and not .net framework 3.0?
Try creating a new project like this:

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.20.0)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1736
Merit: 8448


Fiatheist


View Profile WWW
November 29, 2020, 07:02:18 PM
 #11

There is no core 3.0:



Edit: It's a windows forms app, not a console app.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1043
Merit: 2824


Bitcoin and C♯ Enthusiast


View Profile WWW
November 29, 2020, 07:40:54 PM
Merited by Vod (1), ABCbits (1)
 #12

Edit: It's a windows forms app, not a console app.
You should be able to migrate the app to .net 5: https://docs.microsoft.com/en-us/dotnet/desktop/winforms/migration/?view=netdesktop-5.0

If this is a new project and if you are new to c# and .net I strongly suggest getting more familiar with XAML instead of winforms. The later is windows only and is old and limited while the former is a lot better and there are UI projects such as Avalonia that run on any OS.
If you want to try things out then using a console app is the easiest way to go, otherwise if you want UI install Avalonia and start from there. There is also WPF which is windows only but is ported to .net core and .net too.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.20.0)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1736
Merit: 8448


Fiatheist


View Profile WWW
November 29, 2020, 08:03:50 PM
 #13

If this is a new project and if you are new to c#
I am a beginner on C# and excited about that. I can imagine that any expert on C# can create brilliant programs on Visual Studio. Unfortunately, as far as I've seen in the internet, everything looks complicated. I try to learn, but only amateurly on my free time. I've looked on your projects and you've done some great work, especially FinderOuter. Do you have any e-books to suggest me that you believe are perfect for a beginner?

To clear up, once I say amateurly I mean that I don't have an important knowledge. If I ever have a query like how to insert a button that opens Windows Explorer onclick to choose a file, I'll have to google it. Because I simply don't know how to do it.

I strongly suggest getting more familiar with XAML instead of winforms.
Too bad that winforms are not a good choice. I had tided over with them. Buttons and other stuff look the same like on every single program on winforms. On WPF it looks more professional, something like photoshop.

If you want to try things out then using a console app is the easiest way to go
To prevent any misunderstandings, console app means that it is only available on cmd? It means that it has no UI?


█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
A-Bolt
Legendary
*
Offline Offline

Activity: 2336
Merit: 2385


View Profile
November 29, 2020, 08:06:47 PM
Merited by ABCbits (1), BlackHatCoiner (1)
 #14

What I want to do is converting a hex (128-bit or 256-bit) into mnemonic.

NBitcoin again:
Code:
Byte[] entropy = { 0xfe, 0x5e, 0xa5, 0x18, 0xfb, 0x51, 0x53, 0xd7, 
                    0x34, 0x75, 0x54, 0x52, 0x5c, 0xba, 0xc7, 0x15 }; // 128-bit entropy
            
Mnemonic mnemo = new Mnemonic(Wordlist.English, entropy);
Console.WriteLine(mnemo.ToString());
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1043
Merit: 2824


Bitcoin and C♯ Enthusiast


View Profile WWW
November 29, 2020, 09:24:20 PM
Merited by ABCbits (1), BlackHatCoiner (1)
 #15

Do you have any e-books to suggest me that you believe are perfect for a beginner?
I prefer videos myself, there is a free course by Microsoft here: https://channel9.msdn.com/Series/CSharp-Fundamentals-for-Absolute-Beginners
There are paid ones on Udemy which I hear are good.
For XAML: https://docs.microsoft.com/en-us/dotnet/desktop/wpf/fundamentals/xaml?view=netdesktop-5.0
For MVVM (an architectural pattern that goes well with XAML and C# following the IoC principle): https://www.tutorialspoint.com/mvvm/index.htm
For everything else just Google or feel free to ask me, I'll answer to the best of my abilities.

Quote
To clear up, once I say amateurly I mean that I don't have an important knowledge. If I ever have a query like how to insert a button that opens Windows Explorer onclick to choose a file, I'll have to google it. Because I simply don't know how to do it.
If you want to become familiar with XAML (the language used in UI) you could start a WPF project and then use the designer to simply draw any item such as a button (like you'd do in MS paint) then look at the XAML code that it generates. It may seem overwhelming at first but eventually you'll just type all of that in a much cleaner and more flexible way.

Quote
To prevent any misunderstandings, console app means that it is only available on cmd? It means that it has no UI?
Yes, it is a text-only interface similar to command line in windows. Technically this is a UI (user interface), but is not a GUI (graphical user interface).

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.20.0)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1736
Merit: 8448


Fiatheist


View Profile WWW
December 01, 2020, 07:35:09 AM
 #16

I would like to ask one last thing related to the thread's title. As @A-Bolt posted, NBitcoin has a simple way on converting entropy to mnemonic. Is there any simple way to go backwards? From mnemonic to hexadecimal? I think that this, along with finding a way to encrypt messages with ECC on c#, are the only things that have remained to finish my work.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1043
Merit: 2824


Bitcoin and C♯ Enthusiast


View Profile WWW
December 01, 2020, 08:32:16 AM
 #17

Is there any simple way to go backwards? From mnemonic to hexadecimal?
Take index of each word (an integer), convert it to binary, drop the highest bits and only keep the first 11, repeat this for each word and concatenate the bits to each other. Assume 1, 2 and 3 are the bits (0 or 1) of first, second and third word respectively:
Code:
11111111 11122222 22222233 33333333 3...
https://github.com/Autarkysoft/Denovo/blob/c5e741f76aa9318fc853b75f7a5270effebcc4ba/Src/Autarkysoft.Bitcoin/ImprovementProposals/BIP0039.cs#L121-L167

Quote
I think that this, along with finding a way to encrypt messages with ECC on c#, are the only things that have remained to finish my work.
I could implement ECIES if you are stuck.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.20.0)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1736
Merit: 8448


Fiatheist


View Profile WWW
December 01, 2020, 08:56:41 AM
 #18

Take index of each word (an integer), convert it to binary, drop the highest bits and only keep the first 11, repeat this for each word and concatenate the bits to each other. Assume 1, 2 and 3 are the bits (0 or 1) of first, second and third word respectively:
Code:
11111111 11122222 22222233 33333333 3...
https://github.com/Autarkysoft/Denovo/blob/c5e741f76aa9318fc853b75f7a5270effebcc4ba/Src/Autarkysoft.Bitcoin/ImprovementProposals/BIP0039.cs#L121-L167
I didn't fully understand this. Do you have a function that does that in your library? Because it seems that the link you gave me doesn't do that. (Tbh, I don't understand what exactly public BIP0039 does)

I could implement ECIES if you are stuck.
I'm really stuck on that! I don't know how to do it and yes I would like you to give me some code or a link to your library. I had started this thread asking how to implement it, but didn't understand. Fortunately, I achieved the signing/verifying part, which I was searching too.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1043
Merit: 2824


Bitcoin and C♯ Enthusiast


View Profile WWW
December 01, 2020, 09:28:58 AM
Merited by Heisenberg_Hunter (1)
 #19

I didn't fully understand this. Do you have a function that does that in your library? Because it seems that the link you gave me doesn't do that. (Tbh, I don't understand what exactly public BIP0039 does)
This constructor instantiates BIP-39 (and 32) from a given mnemonic string, it first validates the string which requires converting the words to the entropy, computing its checksum and comparing it with the given checksum. The part of the code I posted is what you want (from mnemonic to entropy which can be converted to hex).
There is no public method for this since this not needed in any real world scenario, however you can copy the code and add a final line at the end using the ToBase16() extension on the entropy like string hex = entropy.ToBase16();

Quote
I'm really stuck on that! I don't know how to do it and yes I would like you to give me some code or a link to your library. I had started this thread asking how to implement it, but didn't understand. Fortunately, I achieved the signing/verifying part, which I was searching too.
There is no code for it yet, I'll have to read how it works and then implement it.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.20.0)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1736
Merit: 8448


Fiatheist


View Profile WWW
December 01, 2020, 11:56:47 AM
 #20

This constructor instantiates BIP-39 (and 32) from a given mnemonic string, it first validates the string which requires converting the words to the entropy, computing its checksum and comparing it with the given checksum. The part of the code I posted is what you want (from mnemonic to entropy which can be converted to hex).
Yes but as far as I can see, within that part of the code there are variables already set outside of it. (for example ENT or wordIndexes). What am I supposed to put there? Copy the entire code?

There is no code for it yet, I'll have to read how it works and then implement it.
The whole encryption/decryption thing is based on pretty complicated maths, so if it's difficult to understand it imagine how difficult it would be for me to implement it on C#. A big thank you for giving a guiding hand to a C# beginner and cryptography enthusiast here. Your merits talk.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!