Xor-el / CryptoLib4Pascal

Crypto for Modern Object Pascal
MIT License
211 stars 65 forks source link

Lazarus form examples? #25

Closed TonyStone31 closed 3 years ago

TonyStone31 commented 3 years ago

My problem is limited documentation and not understanding the example applications given.

I would like a simple example application that possibly shows how to generate bitcoin addresses. I also do not understand fully how to include the neccesary files in my project, which is more of an ignorance issue of mine and understanding of lazarus i suppose.

If we could get some clear examples in a simple form application that would be great. Maybe how to generate bitcoin addresses and also maybe an example of encrypting a memo's text with various crypto algorithms and methods to decrypt.

Xor-el commented 3 years ago

First of all, generating a bitcoin address is not a simple example. You need to understand the process of generating a bitcoin address and break it down into its different modules.

That been said, there are loads of examples in the unit tests and samples folder on how to encrypt and decrypt data, try to read through it and it would pay off.

TonyStone31 commented 3 years ago

I spent the day today going through the code and samples you have in these libraries. I understand there is a process. So far I have been able to put together a little user interface that generates a keypair... i found some examples and enough info in your libraries that i was able to convert the byte array into a hex string... and the next thing i wanted to try and accomplish is making the "compressed" version of a public key. I think I need to just base58 my public key. I found some functions but I have no clue if i am using them properly. I hope you took no offense at my post... i have been reading through. Still struggling to put stuff together. Is there any direct examples of encoding the public key into a base 58 address? If so can you direct me a little bit.

Thanks.

Xor-el commented 3 years ago

Can you share the sample you have come up with? As a project I mean.

TonyStone31 commented 3 years ago

Actually give me a couple days. I would love to share what I have come up with so far. But I have been trying to learn some Pascal basics in the process, so what I have at the moment is a complete embarrassment. As I am trying to put together a simple clean application here I am running into compile errors that are not related to your library. So bare with me. I would love to send my little project to an actual professional to get feedback... I will try and have something put together tonight actually! Thanks Xor-el!

TonyStone31 commented 3 years ago

ok, I have to go to bed. But this is as far as i got so far. I think you can possibly see what I am trying to accomplish. I am basically trying to replicate this web site at the moment. If I didn't need to work in the morning I would have at least been able to complete the base64 on the private key and a few other things. However, I need to conmplete all functions for my project. And while I copy and pasted most of the code I found in your samples I still feel like I cannot find an example on creating a proper WIF address or base 58 address, etc. Any input is appreciated. The code is probably quite messy compared to what you are used to working with but i am open to hearing any feedback you can give me on what I have put together so far. Thanks.

http://coreyhaddad.com/bitcoin/bitaddress.org.htm

TonyStone31 commented 3 years ago

doesnt appear to have uploaded my attachment. I will try again. allIgotSofar.zip

UrbanCohortDev commented 3 years ago

@TonyStone31 Take a look at https://github.com/UrbanCohortDev/PascalCoin-RPC-Client and in particular the PascalCoin.KeyUtils unit to see some examples of using this library.

Xor-el commented 3 years ago

@TonyStone31 , (this is a Cryptographic Library not a Bitcoin Library). what you are requesting for is not within the scope of this library by default, I mean the generation of a Proper Bitcoin WIF address (compressed and uncompressed form) and Base 58 Address. Do not get me wrong, this library is capable of doing that and more, however, it is not just some example I will just whip up in some minutes. I will need to be compensated for that. If this is something you would like to do, please do feel free to reach out to me via mail.

Thanks.

TonyStone31 commented 3 years ago

I just sent you an email. I am willing to compensate you for some of your time!

Xor-el commented 3 years ago

Resolved.