-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66f213a
commit f47dac2
Showing
9 changed files
with
36 additions
and
36 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "discv5" | ||
authors = ["Age Manning <[email protected]>"] | ||
edition = "2018" | ||
version = "0.1.0-beta.2" | ||
version = "0.1.0-beta.3" | ||
description = "Implementation of the p2p discv5 discovery protocol" | ||
license = "MIT" | ||
repository = "https://github.com/sigp/discv5" | ||
|
@@ -15,15 +15,15 @@ exclude = [ | |
] | ||
|
||
[dependencies] | ||
enr = { version = "0.4.0", features = ["k256", "ed25519"] } | ||
enr = { version = "0.5.0", features = ["k256", "ed25519"] } | ||
tokio = { version = "1.1", features = ["net", "sync", "macros"] } | ||
tokio-stream = "0.1.2" | ||
tokio-util = { version = "0.6.2", features = ["time"] } | ||
libp2p-core = { version = "0.27.0", optional = true } | ||
zeroize = { version = "1.1.1", features = ["zeroize_derive"] } | ||
futures = "0.3.8" | ||
uint = { version = "0.8.5", default-features = false } | ||
rlp = "0.4.6" | ||
rlp = "0.5" | ||
sha2 = "0.9.2" | ||
hkdf = "0.10.0" | ||
hex = "0.4.2" | ||
|
@@ -37,7 +37,7 @@ lru_time_cache = "0.11.2" | |
lazy_static = "1.4.0" | ||
aes-gcm = "0.8.0" | ||
aes-ctr = "0.6.0" | ||
k256 = { version = "0.5.10", features = ["zeroize", "ecdh", "sha2"] } | ||
k256 = { version = "0.7", features = ["zeroize", "ecdh", "sha2"] } | ||
tracing = { version = "0.1.21", features = ["log"] } | ||
tracing-subscriber = "0.2.15" | ||
|
||
|
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
//! Implements the static ecdh algorithm required by discv5 in terms of the `k256` library. | ||
use k256::{ | ||
ecdsa::{SigningKey, VerifyKey}, | ||
elliptic_curve::sec1::FromEncodedPoint, | ||
ecdsa::{SigningKey, VerifyingKey}, | ||
elliptic_curve::sec1::ToEncodedPoint, | ||
}; | ||
|
||
pub fn ecdh(public_key: &VerifyKey, secret_key: &SigningKey) -> Vec<u8> { | ||
k256::elliptic_curve::ecdh::PublicKey::from( | ||
(k256::ProjectivePoint::from( | ||
k256::elliptic_curve::AffinePoint::<k256::Secp256k1>::from_encoded_point( | ||
&k256::elliptic_curve::ecdh::PublicKey::from_bytes(public_key.to_bytes().as_ref()) | ||
.unwrap(), | ||
) | ||
.unwrap(), | ||
) * k256::SecretKey::from_bytes(secret_key.to_bytes()) | ||
pub fn ecdh(public_key: &VerifyingKey, secret_key: &SigningKey) -> Vec<u8> { | ||
k256::PublicKey::from_affine( | ||
(&k256::PublicKey::from_sec1_bytes(public_key.to_bytes().as_ref()) | ||
.unwrap() | ||
.secret_scalar()) | ||
.to_projective() | ||
* k256::SecretKey::from_bytes(secret_key.to_bytes()) | ||
.unwrap() | ||
.secret_scalar()) | ||
.to_affine(), | ||
) | ||
.unwrap() | ||
.to_encoded_point(true) | ||
.as_bytes() | ||
.to_vec() | ||
} |
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
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
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
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