jubjub.rs 1001 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. use ff::PrimeField;
  2. use group::Group;
  3. use jubjub::SubgroupPoint;
  4. use bls12_381::Scalar;
  5. fn main() {
  6. let g = SubgroupPoint::from_raw_unchecked(
  7. bls12_381::Scalar::from_raw([
  8. 0xb981_9dc8_2d90_607e,
  9. 0xa361_ee3f_d48f_df77,
  10. 0x52a3_5a8c_1908_dd87,
  11. 0x15a3_6d1f_0f39_0d88,
  12. ]),
  13. bls12_381::Scalar::from_raw([
  14. 0x7b0d_c53c_4ebf_1891,
  15. 0x1f3a_beeb_98fa_d3e8,
  16. 0xf789_1142_c001_d925,
  17. 0x015d_8c7f_5b43_fe33,
  18. ]),
  19. );
  20. let x = g + g;
  21. let x = jubjub::AffinePoint::from(jubjub::ExtendedPoint::from(x));
  22. println!("{:?}", x);
  23. let one = Scalar::from_bytes(&[
  24. 0x01, 0x00, 0x00, 0x00,
  25. 0x00, 0x00, 0x00, 0x00,
  26. 0x00, 0x00, 0x00, 0x00,
  27. 0x00, 0x00, 0x00, 0x00,
  28. 0x00, 0x00, 0x00, 0x00,
  29. 0x00, 0x00, 0x00, 0x00,
  30. 0x00, 0x00, 0x00, 0x00,
  31. 0x00, 0x00, 0x00, 0x00,
  32. ]).unwrap();
  33. assert_eq!(Scalar::one(), one);
  34. }