Giter VIP home page Giter VIP logo

ecctools's Introduction

ecctools

Small collection of tools written in C for ECC and bitcoin

Why this programs are written in C language?

Well i like C language because compiled code is faster than interpreted code.

Warning

  • This repository include a small ECDSA Cryptography library.
  • This library was made by myself reading the documentaion but it can have some bugs.
  • I already implement the use of secure memory provided by the gcrypt library.
  • I just solved #16
  • Use it by your own risk.
  • I use this tools in my daily basis with my own private key.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

List of tools in this repository

How to download and run the code?

For Termux users you need to install some utilities

apt update && apt upgrade
apt install root-repo
apt install git -y
apt install build-essential -y
apt install libssl-dev
apt install libgcrypt20-dev
apt install libgmp-dev

Clone this repository

git clone https://github.com/albertobsd/ecctools.git

Compile:

make

keygen

This tool generate one private and his address/publickey compressed and uncompressed at request.

you can specify the bit size from 1 to 256 with -b value where value is the number of bits in your key. if you don't specify this value the bit may vary from 1 to 256, this will depend only of the RNG

Also you can select the random source for this key -s source, where sourse is one of the next values. The default source is urandom

  • urandom to use the linux device /dev/urandom
  • random to use the linux device /dev/random
  • openssl to use the RND build in openssl library
  • getrandom to use the linux kernet funtcion getrandom, this may be equivalen to urandom in some kernels
  • gcrypt to use RND build in gcrypt library

example:

albertobsd $ ./keygen
KEY (Secret: DON'T SHARE THIS VALUE): 18f619c4d16057d362ddfce772f551d46a2390517698226cff6e5bf67ac4b324
publickey uncompressed: 04af6e50db92ce378c29df0ed9a04d3431bc06762aa37ec3ab42af14708363059616992ab8abb4bd8cfcc7d8c8d40331d419f426d7fc8490efb1af47b6316d7a1b
address uncompressed 1CXHD79mKUxUDruD2iEJxs8XBwiJwYGmTR
publickey compressed: 03af6e50db92ce378c29df0ed9a04d3431bc06762aa37ec3ab42af147083630596
address compressed 1PTA5NaUfu5xU5pEmEfobsZbRuWvs4Sik3

sharedsecret

In cryptography is important to have a shared secret with the person who you are communicating. But is also very important to have a way to communicate this secret without disclose it to all the world.

This tool calculate that shared secret with your privatekey and the publickey of the other person.

Alice (you) want to send a encrypted file to Bob (Other person) Alice have his own privatekey and Alice know the Publickey of Bob.

Alice use this tool to calcualte the share secret to be use to encrypt the file.

Alice example Keys: Private key: 18f619c4d16057d362ddfce772f551d46a2390517698226cff6e5bf67ac4b324 (Unknow for Bob and everyone else) Public key : 03af6e50db92ce378c29df0ed9a04d3431bc06762aa37ec3ab42af147083630596 (Public)

Bob example Keys: Private key: bc9e78f140a76cbdcdbecc5ab0ec38b4db710edfa40dea342712c8a695fe8b22 (Unknow for Alice and everyone else) Public key : 022c8191049a3f2816bc95077b91caed87900d0cd2af3757004531face9c3b6082 (Public)

Alice run the program:

./sharedsecret
A: private key (hex): 18f619c4d16057d362ddfce772f551d46a2390517698226cff6e5bf67ac4b324
B: public key : 022c8191049a3f2816bc95077b91caed87900d0cd2af3757004531face9c3b6082
Secret between A and B: 22fb667f3bc1a2153e3cef75df0ce757a1c86051c07ace6b0c30dc87f3358511 (DON'T SHARE, THIS IS SECRET)

Bob run the program:

./sharedsecret
A: private key (hex): bc9e78f140a76cbdcdbecc5ab0ec38b4db710edfa40dea342712c8a695fe8b22
B: public key : 03af6e50db92ce378c29df0ed9a04d3431bc06762aa37ec3ab42af147083630596
Secret between A and B: 22fb667f3bc1a2153e3cef75df0ce757a1c86051c07ace6b0c30dc87f3358511 (DON'T SHARE, THIS IS SECRET)

Alice and Bob get the same shared secret only sharing their own PUBLIC keys to each other.

Alice procced to encrypt their secret file input.txt with the password 22fb667f3bc1a2153e3cef75df0ce757a1c86051c07ace6b0c30dc87f3358511

openssl aes-256-cbc -salt -pbkdf2 -in input.txt -out input.txt.enc

Bob decrypt the secret file with the command using the same password 22fb667f3bc1a2153e3cef75df0ce757a1c86051c07ace6b0c30dc87f3358511:

openssl aes-256-cbc -d -salt -pbkdf2 -in input.txt.enc -out message.txt

Note for cryptographers this is just a basic proof of concept, i know that the comunication channel can be compromised, there are mitm attacks, there is no authentication or integrity of the data etc...

rehashaddress

A NON standard, deterministic private key generator from a password or passphrase.

what is the objective of this tool? just provide a easy way to generate deterministics privatekeys from a selected password or passphrase and number of rehashes

Advice: USE A SECURE PASSWORD

Example of use

Generate 2 privatekeys and his address after 100 thausand of rehahes

./rehashaddress -p "}78~Et=jPQP5}MVVj2fc0X38{~I}?c" -n 2 -m 100000

Output:

[I] Password: }78~Et=jPQP5}MVVj2fc0X38{~I}?c
[I] n: 2
[I] m: 100000
Privatekey: ca12010ce2daaf02611d440acd42e8bc791881375c58197cf56995059b28e797
Compress publickey: 035f149fb58e6eb5a7bcc812c1f72e5c9a3ee7ea151991a31a4d3e98e5ace25568
Compress address: 16Ln3w1JLD8s7rNni37A7SiVmVPHXEHFWF
Uncompress publickey: 045f149fb58e6eb5a7bcc812c1f72e5c9a3ee7ea151991a31a4d3e98e5ace2556850fc0b339809eda8cc9f74ee698ed018049b0cfbefe72e66dbc256622f1662d7
Uncompress address: 1NKUnTCtN3Pbm3wEVsFZFuotKkjPPi4g3B
Privatekey: 1037ea7cc723e34f3d81d9e01b5b1df081d47312a3d549b67fd635424446c1b0
Compress publickey: 026813442784ee62c0d69dcf244f91518e85f4a796a1b967758aef1b7d88abd23b
Compress address: 1JWH4qYemWFJAULUtcx1QiboDAD64Bb718
Uncompress publickey: 046813442784ee62c0d69dcf244f91518e85f4a796a1b967758aef1b7d88abd23bd7e12a189fa7d6a80154cbf29999b74bece7bfcca8a70e3df92d8ece238e8700
Uncompress address: 1Ho9VcvHcdu5Xrkv3pcME5zaPvyje1AWnM

Please check the comments in the source code rehashaddress.c

calculatefromkey

A easy way to check the address and publickeys from a privatekey

what is the objective of this tool? just to check a privatekey and his address and publickey

Example of use

./calculatefromkey ca12010ce2daaf02611d440acd42e8bc791881375c58197cf56995059b28e797

Output:

privatekey: ca12010ce2daaf02611d440acd42e8bc791881375c58197cf56995059b28e797
publickey compressed: 035f149fb58e6eb5a7bcc812c1f72e5c9a3ee7ea151991a31a4d3e98e5ace25568
public address compressed 16Ln3w1JLD8s7rNni37A7SiVmVPHXEHFWF
publickey uncompressed: 045f149fb58e6eb5a7bcc812c1f72e5c9a3ee7ea151991a31a4d3e98e5ace2556850fc0b339809eda8cc9f74ee698ed018049b0cfbefe72e66dbc256622f1662d7
public address uncompressed 1NKUnTCtN3Pbm3wEVsFZFuotKkjPPi4g3B

calculatefrompublickey

A easy way to check the address from a publickey

What is the objetive of this tool? just check wha are the address from a publickey.

Example of use

./calculatefromkey ca12010ce2daaf02611d440acd42e8bc791881375c58197cf56995059b28e797

Output:

address 16Ln3w1JLD8s7rNni37A7SiVmVPHXEHFWF

keydivision

This is just a proof of concept program just to show how we can divide publickeys.

The result from exact divisions is the same like any decimal number but if the division is not exact the result will be in an unknow place in the curve

Example of use: Divide a publickey bewteen 4 three times in a row:

./keydivision -p 03a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070 -n 3 -d 4

Output:

03f694cbaf2b966c1cc5f7f829d3a907819bc70ebcc1b229d9e81bda2712998b10
02e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d
033ab6bde10cd3ac0cd06883fa66f0b0e3eb1309c0534b812286e2a30ca540db99

explanation: the target publickey 03a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070 have privatekey 0x1000000000000000000000000000000

each line of the output are the result of divide the publickey by 4 lets to check this example with keymath

keymath

Keymath is basically an arithmetic calculator por publickeys with only four operations:

  • addition
  • subtration
  • multiplication by an scalar number
  • division by an scalar number

previous example:

./keymath 03a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070 / 4

output: Result: 03f694cbaf2b966c1cc5f7f829d3a907819bc70ebcc1b229d9e81bda2712998b10

this is the first line of the keydivision example, their privatekey is 0x1000000000000000000000000000000 bewteen 4 equals to 0x400000000000000000000000000000

./keymath 03f694cbaf2b966c1cc5f7f829d3a907819bc70ebcc1b229d9e81bda2712998b10 / 4

output: Result: 02e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d

from here you can do your calculations by your self

multiplication by an scalar number

The multiplication and the division only can be done with a number you can't multiply or divide two publickeys

./keymath 033ab6bde10cd3ac0cd06883fa66f0b0e3eb1309c0534b812286e2a30ca540db99 x 64

Result: 03a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070

modmath

this is an arithmetic calculator but all operations are modulo N, this is Modulo 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

Did you remember that i write before: "not exact the result will be in an unknow place in the curve" I lie, we can know more or less where those result are but even with this information we can't find values when we don't know the PrivateKey value.

./modmath 1 / 2

Output:

Result: 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1

./modmath 3 / 2

Output:

Result: 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a2

if you see those privatekeys are sequentially, Lest to divide the publickeys of 1 and 3 by 2

./keymath 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 / 2

output: Result: 0200000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63

./keymath 02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9 / 2

output: Result: 02c62c910e502cb615a27c58512b6cc2c94f5742f76cb3d12ec993400a3695d413

Know you can comprobate that the publickeys of 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1 and 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a2 are

0200000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63 02c62c910e502cb615a27c58512b6cc2c94f5742f76cb3d12ec993400a3695d413

can you calcualte what is the publickey of 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 with keymath?

./keymath 0200000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63 - 1

output: Result: 0300000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63

addr2rmd

This tool decode legacy address to rmd160 hashes

Example of use:

./addr2rmd -i examples/unsolvedpuzzles.txt -o examples/unsolvedpuzzles.rmd

-i input file -o output file, if the -o option is omited the

verifymsg

This tool help to verify te signature for a bitcoin message.

Example of use:

./verifymsg -m 1E9YwDtYf9R29ekNAfbV7MvB4LNv7v3fGa -a 1NChfewU45oy7Dgn51HwkBFSixaTnyakfj -s "HCsBcgB+Wcm8kOGMH8IpNeg0H4gjCrlqwDf/GlSXphZGBYxm0QkKEPhh9DTJRp2IDNUhVr0FhP9qCqo2W0recNM="

The signature match with the address and it is valid

-----BEGIN BITCOIN SIGNED MESSAGE-----
1E9YwDtYf9R29ekNAfbV7MvB4LNv7v3fGa
-----BEGIN BITCOIN SIGNATURE-----
1NChfewU45oy7Dgn51HwkBFSixaTnyakfj
HCsBcgB+Wcm8kOGMH8IpNeg0H4gjCrlqwDf/GlSXphZGBYxm0QkKEPhh9DTJRp2IDNUhVr0FhP9qCqo2W0recNM=

Also it have some VERBOSE mode -v

Example:

./verifymsg -m 1E9YwDtYf9R29ekNAfbV7MvB4LNv7v3fGa -a 1NChfewU45oy7Dgn51HwkBFSixaTnyakfj -s "HCsBcgB+Wcm8kOGMH8IpNeg0H4gjCrlqwDf/GlSXphZGBYxm0QkKEPhh9DTJRp2IDNUhVr0FhP9qCqo2W0recNM=" -v
Final X, Y : 2b0172007e59c9bc90e18c1fc22935e8341f88230ab96ac037ff1a5497a61646 105ecd499fa11dffe894dead6759ab732baf593b6a4da4b7a7294d5afffa02b7
Final R: 2b0172007e59c9bc90e18c1fc22935e8341f88230ab96ac037ff1a5497a61646
Final S: 058c66d1090a10f861f434c9469d880cd52156bd0584ff6a0aaa365b4ade70d3
Final Z: d6a75acdff18b0a8103f867c6cab8c12ec8ac250dfa8dcdb4f89d8e553270115
Calculated address: 1NChfewU45oy7Dgn51HwkBFSixaTnyakfj
Calculated publickey uncompressed: 044e01f16fe203dbfd8110fd636f42e69bd2fa9e0fef913f00554e4412cb1cae070296f95c6b64f3fdcb7ee9dc838f20b992077e839703b3c2c5427e90e5afd0d1
Calculated publickey compressed: 034e01f16fe203dbfd8110fd636f42e69bd2fa9e0fef913f00554e4412cb1cae07

The signature match with the address and it is valid

-----BEGIN BITCOIN SIGNED MESSAGE-----
1E9YwDtYf9R29ekNAfbV7MvB4LNv7v3fGa
-----BEGIN BITCOIN SIGNATURE-----
1NChfewU45oy7Dgn51HwkBFSixaTnyakfj
HCsBcgB+Wcm8kOGMH8IpNeg0H4gjCrlqwDf/GlSXphZGBYxm0QkKEPhh9DTJRp2IDNUhVr0FhP9qCqo2W0recNM=
-----END BITCOIN SIGNATURE-----

Do you wanna more programs here?

Well just ask for the program that you want. But please don't be annoying, I do this for hobby and fun.

Use the Issue section or the bitcointalk topic:

https://github.com/albertobsd/ecctools/issues

https://bitcointalk.org/index.php?topic=5361234.0

Donations:

  • BTC: 1Coffee1jV4gB5gaXfHgSHDz9xx9QSECVW
  • ETH: 0x6222978c984C22d21b11b5b6b0Dd839C75821069
  • DOGE: DKAG4g2HwVFCLzs7YWdgtcsK6v5jym1ErV

ecctools's People

Contributors

albertobsd 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ecctools's Issues

Keymultiplication

Hi Albertobsd,

Thanks for your projects. Kindly add "keymultiplication" like "keydivision"

Thanks.

What happens if when you divide an odd number like 43

i tried dividing private key 2B (43) by 2 [03d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9 -n 3 -d 2]

where the results are

./keydivision -p 03d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9 -n 3 -d 2
inversemultiplier : 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1
0372032cac3177c280ceb3076d7f5104052413706c956ecf38acf410ada12473a6
0249f0c19658519bec46d379f05d5388bb3a97bb95fe366c636a6bd9b6e90eb946
02052b643cc9bfccf3b168fc7bf2f3fe6151598797641babf45e655e49c8937c66

what's happening can you please explain ?

Core Dumped (segmentation fault)

Hello Alberto i'v been trying to use keydivision with an Input file but it seems to not work. The error i get doing it is in the title and the error i get with the compiler is this :

keydivision.c:167:5: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
167 | fgets(buffer_input,1024,INPUT);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
keydivision.c:206:6: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
206 | fgets(buffer_input,1024,INPUT);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -O3 -o keymath keymath.c gmpecc.o util.o base58.o sha256.o rmd160.o -lgmp
rm *.o

Thank you !

Why then devide to 32 not work ?

I devide 62 bits pubkey to 32

And get this pubkeys:

03782e746d99acac63f8ef9fced1164cd55b20a28b1567ea34ce8dca4b0d890d40
03666b5737758ddeb7bb98a95432cb81c58e9931e32b4b54ffa3b72faec6c33ba6
03666b5737758ddeb7bb98a95432cb81c58e9931e32b4b54ffa3b72faec6c33ba6
03782e746d99acac63f8ef9fced1164cd55b0a28b1567ea34ce8dca4b0d890d40
03f231dc9ca5aa43b5bd96ad639b61a2348bf5918ca4a8ec79c9c4276deed78f8d

Result zero !! Nothin founded.

Albert, please help ?????

Regards.😭

Consecutive substraction

Posting the same comment i left on Youtube ! :D

Hello alberto ! I wanted to know if it is possible to do substraction with the public key the same way it work with keydivision.
Fore exemple instead of writing a line eache time i want to do a substraction with the result of the public key would it be possible to do like : ./keymath (publickey) - 1 -n (number of operations)
In short : Doing consecutive substraction or addition

Build fails on Ubuntu 21.10

Trying to build on Ubuntu 21.10 (gcc 11.2.0) produces the following error:

gcc -O3 -c bloom/bloom.c -o bloom.o
gcc -O3 -c sha256/sha256.c -o sha256.o
gcc -O3 -c base58/base58.c -o base58.o
gcc -O3 -c rmd160/rmd160.c -o rmd160.o
gcc -O3 -c xxhash/xxhash.c -o xxhash.o
gcc -O3 -c gmpecc.c -o gmpecc.o
gcc -O3 -c util.c -o util.o
gcc -O3 -o rehashaddress rehashaddress.c gmpecc.o util.o sha256.o base58.o rmd160.o -lgmp
/usr/bin/ld: gmpecc.o:(.bss+0x2020): multiple definition of `EC'; /tmp/ccEmWNB8.o:(.bss+0x2040): first defined here
/usr/bin/ld: gmpecc.o:(.bss+0x0): multiple definition of `DoublingG'; /tmp/ccEmWNB8.o:(.bss+0x20): first defined here
/usr/bin/ld: gmpecc.o:(.bss+0x2000): multiple definition of `G'; /tmp/ccEmWNB8.o:(.bss+0x2020): first defined here
collect2: error: ld returned 1 exit status

Any advice on how to fix this?

running error

I'm trying to division in the terminal with a total of 1 million rows. When I try to use keymath multiple times, it usually gives an error after the 50th line.

xybelll@asus:~/ecctools$ ./keymath 033c095d0337632b3e82e57e26cdf287b333c4d9c91ace703d269b27ac48329168 / 2
Result: 020733d93ce1a17f3b2298f715c0f12de80de59b675b506f63521d6f21600cdb53

xybelll@asus:~/ecctools$ ./keymath 02ae0e41340c224a04d0f7cabaddaa9d2e24f1d4ec58c6bb522cb8fc3c8292edc1 - 1
Result: 028cbb8b587fde85ccf57ef572f32adb4afc4db86ac10bab724d679900e385dd9f

xybelll@asus:~/ecctools$ ./keymath 02ae0e41340c224a04d0f7cabaddaa9d2e24f1d4ec58c6bb522cb8fc3c8292edc1 / 2
ed346bab06d27e95e5ce1994e7773b2 - 1
Result: 0349a153d280c058b784b0aa9fe50103ed590a4d9706c45953c3b1768a6e499f67

xybelll@asus:~/ecctools$ ./keymath 02144cc68d301d96ee533d9691f581795cbe7876edee019778405610421b55712e - 1
Result: 02c26f5861e25805518eaba2945dae1c27b551d376d1830bd781031f44dde394d9

"ed346bab06d27e95e5ce1994e7773b2 - 1" I can't fix this mistake, and you never know when he'll make this type of mistake. Sometimes when I open 100 transactions in a row, this error happens once, sometimes it happens 3 different times.

How can I run multiple commands for 1 million lines?

Thanks...

Ubuntu compile error ?

Hello Alberto,
Any suggestion about error that I'm get as response , please? Thnx in Advance...

~/ecctools$ sudo make
gcc -O3 -c bloom/bloom.c -o bloom.o
gcc -O3 -c sha256/sha256.c -o sha256.o
gcc -O3 -c base58/base58.c -o base58.o
gcc -O3 -c rmd160/rmd160.c -o rmd160.o
gcc -O3 -c xxhash/xxhash.c -o xxhash.o
gcc -O3 -c gmpecc.c -o gmpecc.o
gmpecc.c:1:10: fatal error: gmp.h: No such file or directory
1 | #include <gmp.h>
| ^~~~~~~
compilation terminated.
make: *** [Makefile:7: default] Error 1

Update:
I'm on Win WSL - so after install $ sudo apt install libcrypt-dh-gmp-perl
also received same error response after "make"

keymath multiplication

Hi alberto.
If i divided the pubkey and got the scalar number and find the new pubkey in keyhunt - how can i calculate the true privkey?

Unsecure EC scalar multiplication

You should warn clearly that this implementation of ECC point multiplication is not secure at all regarding side-channel attacks (power, EM/RF emissions, memory read), and timing measurements. Depending of the bits of the scalar number (usually a private secret), the operations performed are very different.
https://github.com/albertobsd/ecctools/blob/main/gmpecc.c#L99

All the operations requiring this point multiplication are affected and are not secure. Public key computation (with keygen, or calculatefromkey) and sharedsecret ECDH.

This should not be used in any system in production, or securing a private key.

How to limit the number of decimal numbers obtained during calculation and used in calculations ?

Good day.

Then I use keymath and modmath and devide for deviding for example 777 / 999 = 0.77777777777777777....7 inf. modmath and keymath genererate result not with minimum needed float numbers 0.77777777777777777(This will be named X) * 999 = 777.0, but with maximum nposible float number - 0.777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 ........7 (this will be named Y) * 999 = 777.0 and private / publick keys for X and Y are different !!!

How to use in calculus editable floats count in result ?
Bro, help plesse ?

Why this method not work on puzzle privkeys ? p.s. dividing...

Hi

Loock:
we have pubkey of this privkey - 0xfffffffffffffffffffffffff

./md 0xfffffffffffffffffffffffff / 0x4000000000000
Result: 80266a9dd3b03fffffffffffffffffff5d269cebf99579e8f2f9b463c06987c4

./md 0x80266a9dd3b03fffffffffffffffffff5d269cebf99579e8f2f9b463c06987c4 - 0x4000000000000
Result: 80266a9dd3b03fffffffffffffffffff5d269cebf99579e8f2f5b463c06987c4

xman@localhost:~/ecctools$ ./md 0x80266a9dd3b03fffffffffffffffffff5d269cebf99579e8f2f5b463c06987c4 x 0x4000000000000
Result: fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140

xman@localhost:~/ecctools$ ./md 1 - 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140

Result: 2 this is a privkey what belong to pubkey, what we will brute - privkey 2.

we was find orivkey 2, and now we recover this privkey
0xfffffffffffffffffffffffff

./md 1 - 2
Result: fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140

xman@localhost:~/ecctools$ ./md 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140 / 0x4000000000000
Result: 80266a9dd3b03fffffffffffffffffff5d269cebf99579e8f2f5b463c06987c4

./md 0x80266a9dd3b03fffffffffffffffffff5d269cebf99579e8f2f9b463c06987c4 x 0x4000000000000 Result: fffffffffffffffffffffffff

succesfuly recovered.

why method not work with puzzle priv/pubkey ?
I try many times but not succesful.

????

Why this happened ?

Bro, good day or night ;)

Why resulted private key after dividing is bigger then a devided privkey ?

[email protected]:~/ecctools$ ./modmath 0x100000000000000000000000000000
0 / 30240
Result: 61cb720c761cb720c761cb720c761cb6a4811d64db34aaa77c3500a19c342
679

Ho to manipulate with keys for get result < then a
0x100000000000000000000000000000 ??

Thanks !

Error: Some invalid bit in the publickey

If you try to divide the key into a divisor of 66 characters, the program accepts this divisor as a public key.

mark@ubuntu:~/Desktop/ecctools2$ ./keymath 03cd0fdaf5f7503342a20861b15491de59ba31ffe554c42372e4d0926a318cee8e / 963092532556721731126452703333034206412304441762446377444048756866
[E] Some invalid bit in the publickey: 963092532556721731126452703333034206412304441762446377444048756866

Sometimes with this division it gives an error: "We don't know how to divide 2 publickeys, we need an escalar number"

compiling error | kali linux

$ make
gcc -O3 -c bloom/bloom.c -o bloom.o
gcc -O3 -c sha256/sha256.c -o sha256.o
gcc -O3 -c base58/base58.c -o base58.o
gcc -O3 -c rmd160/rmd160.c -o rmd160.o
gcc -O3 -c xxhash/xxhash.c -o xxhash.o
#gcc -O3 -c gmpecc.c -o gmpecc.o
gcc -O3 -c util.c -o util.o
gcc -O3 -o test_functions test_functions.c util.o
gcc -O3 -o rehashaddress rehashaddress.c gmpecc.c util.o sha256.o base58.o rmd160.o -lgmp
rehashaddress.c:41:10: fatal error: gmp.h: No such file or directory
41 | #include <gmp.h>
| ^~~~~~~
compilation terminated.
gmpecc.c:1:10: fatal error: gmp.h: No such file or directory
1 | #include <gmp.h>
| ^~~~~~~
compilation terminated.
make: *** [Makefile:10: default] Error 1

error compiling keygen.c

i am getting errors compiling keygen.c

keygen.c:152:66: warning: unknown conversion type character ‘\x0a’ in format [-Wformat=]
  152 |                                 fprintf(stderr,"OpenSSL error: %l\n",err);
      |                                                                  ^~
keygen.c:152:48: warning: too many arguments for format [-Wformat-extra-args]
  152 |                                 fprintf(stderr,"OpenSSL error: %l\n",err);
      |                                                ^~~~~~~~~~~~~~~~~~~~~
keygen.c:135:25: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-resul
]
  135 |                         fread(buffer_key,1,bytes,fd);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
keygen.c:145:25: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-resul
]
  145 |                         fread(buffer_key,1,bytes,fd);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
keygen.c:158:25: warning: ignoring return value of ‘getrandom’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  158 |                         getrandom(buffer_key,bytes,GRND_NONBLOCK);

Alberto, help please ? ecctools qeschion. asap. help wanted

I was change a N from order.SetBase16("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141") to 2^70

I divide 0xf56926f9ca9abc1065153d25383e80 / -1
Result: 20212ef8c52b3a842d0bc

but then I divide pubkey from

0xf56926f9ca9abc1065153d25383e80 - privkey;

pubkey ./calculatefromkey f56926f9ca9abc1065153d25383e80
privatekey: 0000000000000000000000000000000000f56926f9ca9abc1065153d25383e80
publickey compressed: 02470a635de37b909187e612e5aa853decbb9769416a2ecd055f990c1de501f66c

i gent NOT PUBKEY FROM 20212ef8c52b3a842d0bc

029304ae3d06058417730a717b15727f651188448742442c311a5af9a5b02aa73d

./calculatefromkey 20212ef8c52b3a842d0bc privatekey: 000000000000000000000000000000000000000000020212ef8c52b3a842d0bc
publickey compressed: 03193f6e2afc8e2a243239a25ec7c92807c07833bb66bcc63586ad1e1eadb79406
public address compressed 13HzVpWa3YDVW9sEUEoc9wvJeMCZoCeDYb
publickey uncompressed: 04193f6e2afc8e2a243239a25ec7c92807c07833bb66bcc63586ad1e1eadb794062bcf9a0987701 bd2d1068a024f17c0edfe5f3cf7f7c3df74c2b2989d693c4bd3
public address uncompressed 1Hja51B5T5a2zHCTswdANGPDxYcju1hRQF

./keymath 02470a635de37b909187e612e5aa853decbb9769416a2ecd055f990c1de501f66c / -1
Result: 029304ae3d06058417730a717b15727f651188448742442c311a5af9a5b02aa73d

bupkey are differents, but must be pub1 = pub2 !!!

how to resolve this ?

ASAP.

Thank You

Make please additional function to ./keymath and ./modmath ?

Bro, then try calculate some more difficult for ex divide pubkey + multiply key to number + add to pubkey a number needs paste previous result(from 1, 2, 3 operation etc).

Can you add function for calculate many math operation then just one run ? For ex after publick key add MANY needed operation and calculate for ex:

./keymath 03a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070 / 4 , x 6 , + 1, /6 , + 10, x 3, / 8 etc ???

./modmath 1233456fffeeecc / 4 , x 6 , + 1, /6 , + 10, x 7,+4, / 1 etc ???
Please Bro ?

This function will be very helpful.

Please Bro ?

Thank You

Question

Hi Alberto.

Key math is an arithmetic calculator for public keys, containing only four operations:

-addition
-subtraction
-multiplication by a scalar number
-division by a scalar number

It would be fantastic if we could do these operations "Key math" performed from the "input file.txt" and saved in "output файл.txt ". Let's say we specified one of the four operations (x / + - ) according to which the number "35" or another number will be calculated, then "Key math" we perform this operation with each line from the "output файл.txt ".

rehashaddress Support for entering password from text?

rehashaddress Support for entering password from text,So you can enter multiple passwords!
And the output can specify only print mode,Like below:
Address only
1QLJY8Ep5WWwwoxPFjhNaqWTo7CYUhCfn1
1BFpD2RWHH4byetSdxou5x4cjSioyDR4uc
Private key only
5141853d88d49186ca8de96107e64a1464469da20b1f18d5116fe94bb9c80d99
b62f7b4c940282aae1f3370c0c0cf9d47cf82e2f0d4e8f9fa9f3694d9afa8804
Compressed public key only
020f085d02b5a1230655f4acb00ce3fda60306f20d4260c7e0100c8378d916e778
02436850d41bcaddf94a149a74ae4f2f5c155f9e0f30ef6f788238171018b8bf62
Uncompressed public key only
040f085d02b5a1230655f4acb00ce3fda60306f20d4260c7e0100c8378d916e778430675ac64f252340764620f576dba0ed5ea5106304948949306ba78dec761a0
Print all
5141853d88d49186ca8de96107e64a1464469da20b1f18d5116fe94bb9c80d99
020f085d02b5a1230655f4acb00ce3fda60306f20d4260c7e0100c8378d916e778
1QLJY8Ep5WWwwoxPFjhNaqWTo7CYUhCfn1
040f085d02b5a1230655f4acb00ce3fda60306f20d4260c7e0100c8378d916e778430675ac64f252340764620f576dba0ed5ea5106304948949306ba78dec761a0
1BFpD2RWHH4byetSdxou5x4cjSioyDR4uc

speed test

Good afternoon.
did you run speed tests against the original openssl library and secp256k1?

/ 2

hi @albertobsd !
Can you help me and explain one thing:
example
privkey 0x30a6e39807c92c3533dac2acd41452
pubkey of this privkey 02B5F5D0BF884267CC5B3D6BF5B185AD6CC8BF63704D2BD0951A41B2A1744EB39C
you see that this privkey is odd and it can be divide by 2 equals pubkey also can divide by 2
but when we 0x30a6e39807c92c3533dac2acd41452 / 2 = 0x185371cc03e4960000000000000000 == pubkey = 038C3D7D46F82B9287014A8E248A390760CB58E64DA570F2B6A67720FE41971A8C
and
02B5F5D0BF884267CC5B3D6BF5B185AD6CC8BF63704D2BD0951A41B2A1744EB39C / 2 = 02186bd8fc6ef3103226bc23637c6d13a75a4779ff041f771c71ea386b43d6b4d4

AS you see the pubkeys are differents? why? can you explain if you know. Thank you

keydivision -i file

Tell me how to use it. Command in the terminal. What should be in the file? Error - Segmentation fault.
./keydivision
-i file Input file, input file with public keys to be divided-o file
Output file, if you omit this option the out will go to the standar output

ecctools keymath updates

looking updates for input and output switches for files
example command could be...etc
./keymath -i in-pubkeys.txt -o output-pubkeys.txt / 2
./keymath -i in-pubkeys.txt -o output-pubkeys.txt x 64
looking your updates as early
thanks

same other commands if available for use input and output files will also helpfull for large pictures

Problem install

gcc -O3 -c bloom/bloom.c -o bloom.o
gcc -O3 -c sha256/sha256.c -o sha256.o
gcc -O3 -c base58/base58.c -o base58.o
gcc -O3 -c rmd160/rmd160.c -o rmd160.o
gcc -O3 -c xxhash/xxhash.c -o xxhash.o
gcc -O3 -c gmpecc.c -o gmpecc.o
gmpecc.c:1:10: fatal error: gmp.h: No such file or directory
1 | #include <gmp.h>
| ^~~~~~~
compilation terminated.
make: *** [Makefile:7: default] Error 1

offer

There are no good products in the software at the moment. For bip 39 (BIP32, bip44) and also there are no good bip38 recovery products (this is very necessary.)
If you have the interest and time, the community will owe you a debt.
Thanks for your time and your efforts.
I am not an expert in c but wrote bip 32.44 to work in python. This sparked interest in the community.
BIP 38 is interesting to me personally for restoring access to the wallet.
I will look forward to hearing from you. Your products are unique

calculate incorrect method, Yes?

65096165055322767407827196705577385603448405744130176747093794104152547598903 / 2
32548082527661383703913598352788692801724202872065088373546897052076273799451L
hex(32548082527661383703913598352788692801724202872065088373546897052076273799451)
'0x47f58fd70bfd4fb8f2ce893cbe246a6b9ac94b62c6866db80d886148f1bb911bL'
hex(65096165055322767407827196705577385603448405744130176747093794104152547598903)
'0x8feb1fae17fa9f71e59d12797c48d4d7359296c58d0cdb701b10c291e3772237L'
./keymath 03c07a83ec106864885542bee448da450c7fe2ee5e64db514d4a408cc51faa6edf / 2
Result: 025f64958b1d0b25c6015ce6f76fd7fd15af5f53327c1f16408991f8b4f0de7419, ?

problem

please resolve ./modmath result to HEX and DEC

keydivision

Hello, is this parameter responsible for division in the code?

if(FLAG_DIVISOR == 0 )	{
		mpz_init_set_ui(divisor,0);
	}
	mpz_init(inversemultiplier);
	mpz_invert(inversemultiplier,divisor,EC.n);
	gmp_printf("inversemultiplier : %Zx\n",inversemultiplier);
	if(str_output)	{
		OUTPUT = fopen(str_output,"a");
		if(OUTPUT == NULL)	{
			fprintf(stderr,"can't opent file %s\n",str_output);
			OUTPUT = stdout;
		}
	}
	else	{
		OUTPUT = stdout;
	}

I just want to change it, add multiplication and subtraction. But I can’t understand what exactly is responsible for the division. When I try to add multiplication, the output is just zeros.

./modmath

Hi ./ modmath givinf result in HEX value...can you please make it in HEX and DEC or Can we able to choose weather its HEX or DEC please?

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.