Refactor using of crypto functions#1796
Closed
g1itch wants to merge 14 commits into
Closed
Conversation
00bb768 to
fe85e60
Compare
4e79577 to
f2a24ea
Compare
ef0c7d6 to
3e6f7aa
Compare
PeterSurda
reviewed
Nov 15, 2021
| self.assertEqual( | ||
| sample_wif_privsigningkey, | ||
| highlevelcrypto.decodeWalletImportFormat( | ||
| b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm')) |
Member
There was a problem hiding this comment.
these binary data should also be a variable in samples.
PeterSurda
reviewed
Nov 15, 2021
| def test_double_sha512(self): | ||
| """Reproduce the example on page 1 of the Specification""" | ||
| self.assertEqual( | ||
| highlevelcrypto.double_sha512(b'hello'), sample_double_sha512) |
Member
There was a problem hiding this comment.
ideally b'hello' should also be a variable in samples
Collaborator
Author
There was a problem hiding this comment.
Member
|
overall nice work, although I haven't investigated it in depth |
Collaborator
Author
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. |
Closed
66cb016 to
b1c1401
Compare
g1itch
commented
Dec 10, 2021
| """Generate keys from *passphrase* and *nonce* (encoded as varint)""" | ||
| priv = hashlib.sha512(passphrase + nonce).digest()[:32] | ||
| pub = pointMult(priv) | ||
| return priv, pub |
Collaborator
Author
There was a problem hiding this comment.
I'm not sure if these functions should return the pair or only the private key.
not addresses, where it's supposed to be because it uses pyelliptic.arithmetic, addresses.decodeBase58() returns int which needs to be encoded. Defined encodeWalletImportFormat() and replaced all uses.
this implementation for deterministic keys requires a passphrase of type bytes
jd-2205
pushed a commit
to jd-2205/PyBitmessage
that referenced
this pull request
Jul 22, 2022
jd-2205
pushed a commit
to jd-2205/PyBitmessage
that referenced
this pull request
Aug 5, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this branch I'm gonna cover by tests all the crypto functions used in code and do a refactoring. Basic points:
highlevelcryptoshould import frompyelliptichighlevelcryptoshould not depend on the app state e.g. modulestateorBMConfigparser()instance (the same will be done forprotocolin Compatibility tests #1788)highlevelcryptoshould include hashes - double sha512, ripemd160pyellipticinto the separate repo to show a possible way of addressing Clarification on backport of pyelliptic requested + external dependency unbundling #886