#![allow(incomplete_features)] #![feature(generic_const_exprs)] #![feature(const_trait_impl)] mod bn254; use bn254::{U256, BN254}; use cryptix_bigint::bigint; use cryptix_field::{Element, field::primefield::FpElement}; #[test] fn test_add() { let a: Element = bigint!(U256, "551e8e3d059337e403273bb5cfbe18ec3b07f6eea014b7e32829a88101a76648").into(); let b: Element = bigint!(U256, "0f44148ca6427affe2d16f7402ad1da381fb3002db6aa1c0b414a52e715abe88").into(); let c = a + b; assert_eq!(c, bigint!(U256, "1a1bd9c52bd5b2e071901029d26b367efac126f17b7f597c8e3e4daf730224aa").into()); } #[test] fn test_mul() { let a: Element = bigint!(U256, "551e8e3d059337e403273bb5cfbe18ec3b07f6eea014b7e32829a88101a76648").into(); let b: Element = bigint!(U256, "0f44148ca6427affe2d16f7402ad1da381fb3002db6aa1c0b414a52e715abe88").into(); let c = a * b; let x = FpElement(a); let y = FpElement(b); assert_eq!((x * y).0, c); assert_eq!(c, bigint!(U256, "0f8dcf5d18658b1ff8eb23bd0ae4fd4801689488098f2f5c185f9802964e39bd").into()); }