forked from paramiko/paramiko
-
Notifications
You must be signed in to change notification settings - Fork 9
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
pkey: shared implementation of __hash__() and __str__() #114
Merged
Conversation
This file contains 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
Just use `asbytes()` in `__hash__()` for simplicity. For python3, `__str__()` would raise exceptions for most key types, and was uselessly mangled for RSAKey. Make it return a string with type and fingerprint. (Keep old behavior for python2: public key bytes.) fixes paramiko#853
2fe8989
to
e2d4771
Compare
... more similar to how all other pkey classes work (but still not exactly the same). Also always set verifying_key in __init__(), simplifies a bit. Slightly refactor awkward _decode_key() data argument in the other pkey subclasses too.
a bit cleaner this way
91e15ac
to
4b6762b
Compare
ploxiln
added a commit
that referenced
this pull request
Dec 9, 2021
Just use `asbytes()` in `__hash__()` for simplicity. For python3, `__str__()` would raise exceptions for most key types, and was uselessly mangled for RSAKey. Make it return a string with type and fingerprint. (Keep old behavior for python2: public key bytes.) fixes paramiko#853 backport of 30a09ce from #114 (but using md5 fingerprint instead of sha256)
ploxiln
added a commit
that referenced
this pull request
Dec 9, 2021
For python3, `__str__()` would raise exceptions for most key types, and was uselessly mangled for RSAKey. Make it return a string with type and fingerprint. (Keep old behavior for python2: public key bytes.) Also give AgentKey a __hash__() implementation. fixes paramiko#853 partial backport of 30a09ce from #114 (but need to inline sha256-base64 fingerprint style)
ploxiln
added a commit
that referenced
this pull request
Dec 9, 2021
For python3, `__str__()` would raise exceptions for most key types, and was uselessly mangled for RSAKey. Make it return a string with type and fingerprint. (Keep old behavior for python2: public key bytes.) Also give AgentKey a __hash__() implementation. fixes paramiko#853 partial backport of 30a09ce from #114 (but need to inline sha256-base64 fingerprint style)
ploxiln
added a commit
that referenced
this pull request
Jan 4, 2022
ploxiln
added a commit
that referenced
this pull request
Jan 4, 2022
ploxiln
added a commit
that referenced
this pull request
Jan 6, 2022
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.
Just use
asbytes()
in__hash__()
for simplicity.For python3,
__str__()
would raise exceptions for mostkey types, and was uselessly mangled for RSAKey. Make it
return a string with type and fingerprint.
(Keep old behavior for python2: public key bytes.)
fixes paramiko#853