Skip to content

Refactor using of crypto functions #1796

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

Closed
wants to merge 14 commits into from
Closed

Conversation

g1itch
Copy link
Collaborator

@g1itch g1itch commented Jul 28, 2021

In this branch I'm gonna cover by tests all the crypto functions used in code and do a refactoring. Basic points:

self.assertEqual(
sample_wif_privsigningkey,
highlevelcrypto.decodeWalletImportFormat(
b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm'))
Copy link
Member

Choose a reason for hiding this comment

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

these binary data should also be a variable in samples.

def test_double_sha512(self):
"""Reproduce the example on page 1 of the Specification"""
self.assertEqual(
highlevelcrypto.double_sha512(b'hello'), sample_double_sha512)
Copy link
Member

Choose a reason for hiding this comment

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

ideally b'hello' should also be a variable in samples

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@PeterSurda
Copy link
Member

overall nice work, although I haven't investigated it in depth

@g1itch
Copy link
Collaborator Author

g1itch commented Nov 15, 2021

overall nice work, although I haven't investigated it in depth

It seems that I misplaced (or misnamed) the signatures. I was going to regenerate them. And there is also a lot of unfinished changes here, mentioned in the PR description.

@g1itch g1itch mentioned this pull request Nov 15, 2021
@g1itch g1itch force-pushed the crypto branch 2 times, most recently from 66cb016 to b1c1401 Compare December 10, 2021 16:56
"""Generate keys from *passphrase* and *nonce* (encoded as varint)"""
priv = hashlib.sha512(passphrase + nonce).digest()[:32]
pub = pointMult(priv)
return priv, pub
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure if these functions should return the pair or only the private key.

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

Successfully merging this pull request may close these issues.

2 participants