Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed Jul 24, 2023
1 parent af9cb2b commit 2bf35ab
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
name = "everscale-crypto"
description = "Cryptography primitives for Everscale"
repository = "https://github.com/broxus/everscale-crypto"
version = "0.2.0-pre.2"
version = "0.2.0"
edition = "2021"
include = ["src/**/*.rs", "README.md", "LICENSE"]
license-file = "./LICENSE"

[dependencies]
curve25519-dalek = "4.0.0-rc.3"
curve25519-dalek = "4.0.0"
generic-array = { version = "0.14", features = ["more_lengths"] }
hex = "0.4.3"
rand = "0.8.4"
Expand Down
27 changes: 27 additions & 0 deletions src/ed25519/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,33 @@ mod tests {
assert!(!second_pubkey.verify(data, &signature))
}

#[test]
fn correct_shared_secret() {
let first = ExpandedSecretKey::from(&SecretKey::from_bytes([
215, 30, 117, 171, 183, 9, 171, 48, 212, 45, 10, 198, 14, 66, 109, 80, 163, 180, 194,
66, 82, 184, 13, 48, 240, 102, 40, 110, 156, 5, 13, 143,
]));
let first_pubkey = PublicKey::from(&first);

let second = ExpandedSecretKey::from(&SecretKey::from_bytes([
181, 115, 13, 55, 26, 150, 138, 43, 66, 28, 162, 50, 0, 133, 120, 24, 20, 142, 183, 60,
159, 53, 200, 97, 14, 123, 63, 249, 222, 211, 186, 99,
]));
let second_pubkey = PublicKey::from(&second);

let first_shared_key = first.compute_shared_secret(&second_pubkey);
let second_shared_key = second.compute_shared_secret(&first_pubkey);

assert_eq!(
first_shared_key,
[
30, 243, 238, 65, 216, 53, 237, 172, 6, 120, 204, 220, 34, 163, 18, 28, 181, 245,
215, 233, 98, 0, 87, 11, 85, 6, 41, 130, 140, 95, 66, 72
]
);
assert_eq!(first_shared_key, second_shared_key);
}

#[test]
fn same_shared_secret() {
let first = ExpandedSecretKey::from(&SecretKey::generate(&mut rand::thread_rng()));
Expand Down

0 comments on commit 2bf35ab

Please sign in to comment.