Explorar el Código

update pasta files with better curve info data

narodnik hace 5 años
padre
commit
44cd6e2803
Se han modificado 2 ficheros con 12 adiciones y 6 borrados
  1. 1 0
      scripts/pasta/Cargo.toml
  2. 11 6
      scripts/pasta/main.rs

+ 1 - 0
scripts/pasta/Cargo.toml

@@ -8,6 +8,7 @@ edition = "2018"
 pasta_curves = { path = "/home/narodnik/src/sw/zectings/pasta_curves" }
 ff = "0.9"
 group = "0.9"
+rand = "0.8.4"
 
 [[bin]]
 name = "pasta"

+ 11 - 6
scripts/pasta/main.rs

@@ -1,14 +1,19 @@
 use pasta_curves as pasta;
 use group::{Group, Curve};
+use rand::rngs::OsRng;
 
 fn main() {
-    let a = pasta::vesta::Point::generator();
-    println!("a = {:?}", a.to_affine());
+    let g = pasta::vesta::Point::generator();
+    println!("G = {:?}", g.to_affine());
     let x = pasta::vesta::Scalar::from(87u64);
-    println!("x = {:?}", x);
-    let b = a * x;
-    println!("b = {:?}", b.to_affine());
+    println!("x = 87 = {:?}", x);
+    let b = g * x;
+    println!("B = xG = {:?}", b.to_affine());
 
     let y = x - pasta::vesta::Scalar::from(90u64);
-    println!("y = {:?}", y);
+    println!("y = x - 90 = {:?}", y);
+
+    let c = pasta::vesta::Point::random(&mut OsRng);
+    let d = pasta::vesta::Point::random(&mut OsRng);
+    println!("C = {:?}", c.to_affine());
 }