https://github.com/ConsenSys/gnark-crypto
github.com/consensys/gnark
cloudflare
func finalExponentiation(in *gfP12, pool *bnPool) *gfP12 {
d := newGFp12(pool)
// This is the p^6-Frobenius
d.x.Negative(in.x)
d.y.Set(in.y)
inv := newGFp12(pool)
inv.Invert(in, pool)
d.Mul(d, inv, pool)
t2 := newGFp12(pool).FrobeniusP2(d, pool)
d.Mul(d, t2, pool)
p2 := new(big.Int).Mul(p, p)
p3 := new(big.Int).Mul(p2, p)
p4 := new(big.Int).Mul(p3, p)
p6 := new(big.Int).Mul(p3, p3)
p12 := new(big.Int).Mul(p6, p6)
p7 := new(big.Int).Mul(p6, p)
t := new(big.Int).Sub(p4, p2)
one := big.NewInt(1)
t.Add(t, one)
//t.Mod(t, Order)
t.Div(t, Order)
t.Mul(t, p12)
fmt.Println(t)
u2 := new(big.Int).Mul(u, u)
u3 := new(big.Int).Mul(u2, u)
y2 := new(big.Int).Mul(u2, p2)
y3 := new(big.Int).Mul(u, p7)
y0 := new(big.Int).Add(p, p2)
y0.Add(y0, p3)
y1 := p6
y5 := new(big.Int).Mul(u2, p6)
u2p := new(big.Int).Mul(u2, p)
y4 := new(big.Int).Add(u, u2p)
y4.Mul(y4, p6)
y6 := new(big.Int).Add(p, one)
y6.Mul(y6, u3)
y6.Mul(y6, p6)
t0 := new(big.Int).Add(y6, y6)
t0.Add(t0, y4)
t0.Add(t0, y5)
t1 := new(big.Int).Add(y3, y5)
t1.Add(t1, t0)
t0.Add(t0, y2)
t1.Add(t1, t1)
t1.Add(t1, t0)
t1.Add(t1, t1)
t0.Add(t1, y1)
t1.Add(t1, y0)
t0.Add(t0, t0)
t0.Add(t0, t1)
fmt.Println(t0)
r1 := newGFp12(pool).Exp(d, t0, pool)
r2 := newGFp12(pool).Exp(d, t, pool)
if !bytes.Equal((>{r2}).Marshal(), (>{r1}).Marshal()){
panic("e")
}
//panic("a")
return r1
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理