mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-15 20:23:08 +00:00
reorg
This commit is contained in:
parent
c83dcccada
commit
68cde336a3
@ -23,9 +23,9 @@ pub(crate) fn combined_kernel() -> Kernel {
|
||||
include_str!("asm/core/terminate.asm"),
|
||||
include_str!("asm/core/transfer.asm"),
|
||||
include_str!("asm/core/util.asm"),
|
||||
include_str!("asm/curve/bn254/curve_add.asm"),
|
||||
include_str!("asm/curve/bn254/curve_mul.asm"),
|
||||
include_str!("asm/curve/bn254/moddiv.asm"),
|
||||
include_str!("asm/curve/bn254/curve_arithmetic/curve_add.asm"),
|
||||
include_str!("asm/curve/bn254/curve_arithmetic/curve_mul.asm"),
|
||||
include_str!("asm/curve/bn254/field_arithmetic/moddiv.asm"),
|
||||
include_str!("asm/curve/common.asm"),
|
||||
include_str!("asm/curve/secp256k1/curve_mul.asm"),
|
||||
include_str!("asm/curve/secp256k1/curve_add.asm"),
|
||||
@ -34,9 +34,9 @@ pub(crate) fn combined_kernel() -> Kernel {
|
||||
include_str!("asm/curve/secp256k1/lift_x.asm"),
|
||||
include_str!("asm/curve/secp256k1/moddiv.asm"),
|
||||
include_str!("asm/exp.asm"),
|
||||
include_str!("asm/fields/field_macros.asm"),
|
||||
include_str!("asm/fields/fp6_mul.asm"),
|
||||
include_str!("asm/fields/fp12_mul.asm"),
|
||||
include_str!("asm/curve/bn254/field_arithmetic/field_macros.asm"),
|
||||
include_str!("asm/curve/bn254/field_arithmetic/fp6_mul.asm"),
|
||||
include_str!("asm/curve/bn254/field_arithmetic/fp12_mul.asm"),
|
||||
include_str!("asm/halt.asm"),
|
||||
include_str!("asm/main.asm"),
|
||||
include_str!("asm/memory/core.asm"),
|
||||
|
||||
@ -310,4 +310,4 @@ global ec_double:
|
||||
SWAP2
|
||||
// stack: retdest, u256::MAX, u256::MAX
|
||||
JUMP
|
||||
%endmacro
|
||||
%endmacro
|
||||
@ -0,0 +1,16 @@
|
||||
/// p1, p2 : [Fp; 2], q : [Fp2; 2]
|
||||
|
||||
/// def cord(p1x, p1y, p2x, p2y, qx, qy):
|
||||
/// return sparse_embed(
|
||||
/// p1y*p2x - p2y*p1x,
|
||||
/// (p2y - p1y) * qx,
|
||||
/// (p1x - p2x) * qy,
|
||||
/// )
|
||||
|
||||
/// def tangent(px, py, qx, qy):
|
||||
/// return sparse_embed(
|
||||
/// -9 + py**2,
|
||||
/// (-3*px**2) * qx,
|
||||
/// (2*py) * qy,
|
||||
/// )
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
/// def tate(P : [Fp; 2], Q: [Fp2; 2]) -> Fp12:
|
||||
/// out = miller_loop(P)
|
||||
///
|
||||
/// inv = inverse_fp12(out)
|
||||
/// out = frob_fp12_6(out)
|
||||
/// out = mul_fp12(out, inv)
|
||||
///
|
||||
/// acx = frob_fp12_2(out)
|
||||
/// out = mul_fp12(acx, out)
|
||||
///
|
||||
/// pow = fast_exp(out)
|
||||
/// out = frob_fp12_3(out)
|
||||
/// return mul_fp12(out, pow)
|
||||
|
||||
global tate:
|
||||
// stack: ptr, out
|
||||
PUSH 1
|
||||
// stack: 1, ptr, out
|
||||
PUSH 100
|
||||
// stack: 100, 1, ptr, out
|
||||
%mstore_kernel_general
|
||||
|
||||
|
||||
/// def miller_loop(P):
|
||||
/// out = 1
|
||||
/// O = P
|
||||
/// for i in EXP[1:-1]:
|
||||
/// out = square_fp12(out)
|
||||
/// line = tangent(O, Q)
|
||||
/// out = mul_fp12_sparse(out, line)
|
||||
/// O += O
|
||||
/// if i:
|
||||
/// line = cord(P, O, Q)
|
||||
/// out = mul_fp12_sparse(out, line)
|
||||
/// O += P
|
||||
/// out = square_fp12(out)
|
||||
/// line = tangent(O, Q)
|
||||
/// return mul_fp12_sparse(out, line)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user