-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rs
40 lines (32 loc) · 1.17 KB
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#![warn(clippy::all, clippy::pedantic, clippy::style, rust_2018_idioms)]
#![allow(
clippy::must_use_candidate,
clippy::return_self_not_must_use,
clippy::module_name_repetitions
)]
use crate::elliptic_curve::private_key::PrivateKey;
use elliptic_curve::secp256k1::Secp256k1Felt;
pub mod elliptic_curve;
pub mod finite_fields;
mod helpers;
fn main() {
let secret = Secp256k1Felt::new(0xdeadbeef12345_u64.into());
let wallet = PrivateKey::new(secret);
let public_key = wallet.public_key();
println!(
"Public key: {:?}",
public_key
.sec_uncompressed()
.map(|v| v.iter().fold(String::new(), |mut acc, v| {
acc.push_str(&format!("{:02x}", v));
acc
}))
);
// let signature = wallet.sign_slice(b"Programming Bitcoin!");
// // let is_legit = wallet.verify_slice(b"Programming Bitcoin", &signature);
// // println!("Shouldn't be legit: {}", is_legit);
// let now = std::time::Instant::now();
// let is_legit = wallet.verify_slice(b"Programming Bitcoin!", &signature);
// println!("Should be legit: {}", is_legit);
// println!("Time: {:?}", now.elapsed());
}