Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored master branch #24

Merged
merged 1 commit into from
Nov 27, 2023
Merged

Sourcery refactored master branch #24

merged 1 commit into from
Nov 27, 2023

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Nov 27, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from daedalus November 27, 2023 19:46
Comment on lines -10 to +14
from sage.all_cmdline import *
from sage.all_cmdline import *
import gmpy2

# order is from secp256k1 curve it can be used any other.
order = int(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141)
order = 115792089237316195423570985008687907852837564279074904382605163141518161494337
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 10-14 refactored with the following changes:

if limit == None:
if limit is None:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function load_csv refactored with the following changes:

@@ -76,7 +76,6 @@ def privkeys_from_reduced_matrix(msgs, sigs, pubs, matrix):
keys.append(key)
except Exception as e:
sys.stderr.write(str(e)+"\n")
pass
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function privkeys_from_reduced_matrix refactored with the following changes:

Comment on lines -101 to +102
keys = privkeys_from_reduced_matrix(msgs, sigs, pubs, new_matrix)
else:
new_matrix = matrix.BKZ(early_red=True, use_siegel=True)
keys = privkeys_from_reduced_matrix(msgs, sigs, pubs, new_matrix)

keys = privkeys_from_reduced_matrix(msgs, sigs, pubs, new_matrix)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function main refactored with the following changes:

Comment on lines -22 to +27
nonces = [fixed_bits + random.randrange(1, 2 ** bits) for i in range(n)]
nonces = [fixed_bits + random.randrange(1, 2 ** bits) for _ in range(n)]
else:
# generate n least significant bits, nonce must be less than order
nonces = [random.randrange(2 ** bits, order) + fixed_bits for i in range(n)]
nonces = [random.randrange(2 ** bits, order) + fixed_bits for _ in range(n)]

msgs = [random.randrange(1, order) for i in range(n)]
msgs = [random.randrange(1, order) for _ in range(n)]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 22-27 refactored with the following changes:

Comment on lines -31 to +32
tmpstr = hex(i)
hexstr = tmpstr.replace('0x','').replace('L','').zfill(64)
return hexstr
tmpstr = hex(i)
return tmpstr.replace('0x','').replace('L','').zfill(64)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function inttohex refactored with the following changes:

Comment on lines -36 to +37
print("%s,%s,%s,%s,%s" % ("1111",inttohex(sigs[i].r),inttohex(sigs[i].s),inttohex(msgs[i]),"0000"))
print(
f"1111,{inttohex(sigs[i].r)},{inttohex(sigs[i].s)},{inttohex(msgs[i])},0000"
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 36-36 refactored with the following changes:

@daedalus daedalus merged commit 37dd781 into master Nov 27, 2023
2 checks passed
@daedalus daedalus deleted the sourcery/master branch November 27, 2023 20:36
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.

1 participant