This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Conversation
davxy
suggested changes
Nov 5, 2022
| // convert to ETH address | ||
| <[u8; 20]>::try_from( | ||
| sp_io::hashing::keccak_256(&uncompressed.as_bytes()[1..])[12..].as_ref(), | ||
| sp_io::hashing::keccak_256(uncompressed.as_bytes())[12..].as_ref(), |
Member
There was a problem hiding this comment.
The (standard) byte-encoded form for uncompressed pub keys still uses the first byte to express that the byte sequence represents the uncompressed form (i.e. 0x04 value for the tag).
(https://github.com/RustCrypto/formats/blob/bbab401934a2e93d28053fd74613ffef74cd6e88/sec1/src/point.rs#L132)
Member
|
This is already happening here #12085 and paritytech/polkadot#6238 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
k256to 0.11. It includes some security fixes (added zeroization of secret data), bug fixes, and quality of life improvements (like recoverable signature derivation). Unfortunately, the old version ofk256locks projects usingsubstrateout of upgradingk256themselves (workspaces: overzealous native library dependency conflicting rust-lang/cargo#7880).EncodedPointdoes not include a tag byte (see https://github.com/RustCrypto/formats/blob/master/sec1/src/point.rs#L120), so taking a hash of[1..]will lead to an incorrect address.