Skip to content

InternetMaximalism/plonky2_bn254

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

plonky2_bn254

Rust License

Overview

This repository primarily focuses on the starky implementation of scalar multiplication on the bn254 curve, and provides various utility functions for elliptic curves on the bn254 curve.

Usage

g1 scalar multiplication

let mut builder = CircuitBuilder::<F, D>::new(CircuitConfig::default());
let scalar = builder.add_virtual_biguint_target(8);
let x = G1Target::new_checked(&mut builder);
let offset = G1Target::new_checked(&mut builder);
let output = builder.g1_scalar_mul::<C>(scalar, x, offset);

g2 scalar multiplication

let mut builder = CircuitBuilder::<F, D>::new(CircuitConfig::default());
let scalar = builder.add_virtual_biguint_target(8);
let x = FqTarget::new_checked(&mut builder);
let offset = G2Target::new_checked(&mut builder);
let output = builder.g2_scalar_mul::<C>(scalar, x, offset);

fq exponentiation

let mut builder = CircuitBuilder::<F, D>::new(CircuitConfig::default());
let scalar = builder.add_virtual_biguint_target(8);
let x = FqTarget::new_checked(&mut builder);
let output = builder.fq_exp::<C>(s, x)

map from fq2 to g2

let mut builder = CircuitBuilder::<F, D>::new(config);
let input_t = Fq2Target::constant(&mut builder, &input);
let output_t = G2Target::map_to_g2_circuit::<C>(&mut builder, &input_t);

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages