Skip to content

Conversation

@username1565
Copy link

Hello. If you want, you can create another branch for python3,
and save this there, then test, and fix something.

Changes:

1. mini_esdsa.py.
	Rewrite for Python 3.2.5
	Add additional functions:
	- fast pow_mod, to check is point on curve or not - faster.
	- add () for print operator.
	- remove space at line 202
	- add pow_mod as parameter for contains function. By default this is 0,
		and function can be called with two parameters.
	- add comment for additive inversion
	- add functions to subtract, divide, get Y-coordinate and Point, by X-coordinate and parity.
	- fix mult_inv function. Now this return tuple with gcd, if this not 1.
	- add two optional parameters for brute-force function. start=0, and show_each=0; by default this is nulls.
		start=N run brutefource from specified start-number,
		show_each=M - show the new start number, after each M checked invalid points.
	- for baby-step-giant-step method, add optional parameter m=0, because this was been hardcoded as sqrt(n).
		See comments there.
	- maybe giant steps need to be fixed...
	- add additional cycle to restart pollard_rho, because sometimes this is not working, when mult_inv is incorrect.
		Now this restarting, if mult_inv return tupple, not nubmer.
	- add test function
	- run one test as demo.
	- add commented test in cycle.

2. Readme.md - Fixed. Maybe need to add some additional commands there.

1. mini_esdsa.py.
	Rewrite for Python 3.2.5
	Add additional functions:
	- fast pow_mod, to check is point on curve or not - faster.
	- add () for print operator.
	- remove space at line 202
	- add pow_mod as parameter for contains function. By default this is 0,
		and function can be called with two parameters.
	- add comment for additive inversion
	- add functions to subtract, divide, get Y-coordinate and Point, by X-coordinate and parity.
	- fix mult_inv function. Now this return tuple with gcd, if this not 1.
	- add two optional parameters for brute-force function. start=0, and show_each=0; by default this is nulls.
		start=N run brutefource from specified start-number,
		show_each=M - show the new start number, after each M checked invalid points.
	- for baby-step-giant-step method, add optional parameter m=0, because this was been hardcoded as sqrt(n).
		See comments there.
	- maybe giant steps need to be fixed...
	- add additional cycle to restart pollard_rho, because sometimes this is not working, when mult_inv is incorrect.
		Now this restarting, if mult_inv return tupple, not nubmer.
	- add test function
	- run one test as demo.
	- add commented test in cycle.

2. Readme.md - Fixed. Maybe need to add some additional commands there.
@qubd
Copy link
Owner

qubd commented Oct 13, 2019

Cool! Thanks for doing this and letting me know.

I have no time for maintaining this repo at the moment, but at the end of the term (December) I'll look over your changes and merge them here. I'll also either make a python 3 branch, or add a link in the readme to your fork.

Changes:
mini_ecdsa.py
	- comment test print in divide_point function.
	return Y%self.char in getY function
	return X%self.char in get_point_by_X, because for big x was been returned the point with big x,
		and this contains on curve, because modulo in [0,...,p] is correct.
	Add two strings with comments and remove all tests.
		Tests are moved in tests_mini_ecdsa.py

tests_mini_ecdsa.py - add moved tests from old mini_ecdsa.py

ECC.py - add draft Elliptic-Curve-Encryption implementation. Need to test this, fix bug and optimize.
tests_ECC.py - add tests the functions in ECC.py in this file. 

See source code, and read the comments, try to optimize. Unlicense and WTFPL AS IS.
@username1565
Copy link
Author

If you have free time, you can test and try to optimize Elliptic-Curve-Cryptography.
Just for fun. See my ideas in the source code.
And... This is working!

Best regards.

@qubd
Copy link
Owner

qubd commented Jan 26, 2021

Just migrated to python3 with minimal changes. No intentions to optimize performance or add more functionality at the moment. I'd like to keep this repo minimal and let others fork it and have fun with that!

I'll look into the problems with the baby-step giant-step and pollard rho methods over the next few days.

@qubd
Copy link
Owner

qubd commented Jul 2, 2021

Turns out I didn't end up looking into the baby-step giant-step and rho issues over the next few days. =]

Now I have time though.

It appears at first glance that the problems in these methods arise only when making use of the extensions you've added. In the case of baby-step giant-step, when the optional argument is used, and in the case of rho, when the subgroup order n is not prime.

I've added some comments to make it clear that some of the methods require the order of the subgroup to be prime (in fact, I wrote all of the code here under that assumption, this is briefly mentioned in the readme).

If you have a example where the original baby-step giant-step procedure goes wrong, or where the rho procedure fails when the subgroup order is prime, let me know.

Thanks again for the contribution. I would eventually like to add Diffie-Hellman to this module, so I may yet merge some of your changes in, but it likely won't happen anytime soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants