V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
wangshouh
V2EX  ›  问与答

多签名下如何进行 SECP256K1 公钥乘法?

  •  
  •   wangshouh · Jun 23, 2022 · 1353 views
    This topic created in 1416 days ago, the information mentioned may be changed or developed.

    最近在研究多签名,参考了这篇文章

    在实现 2-of-2 MuSig 时,我完成了公钥的加法运算,但对于公钥的乘法运算我始终无法得到如下结果:

    P₁' = P₁ * c₁
    P₁'  = 0x73e7ab3bcbd3194f01f9a60468cafc557d29043c3d230c98c57107e366ebd0ed * 0xecce388649143900eb4f2b107fcbde7d240336b7f4ad5c37c987701c0eb9159b
    P₁'  = 0x031601087da98f7b3afe201984821727f55cc3176278dbcbb1eabbbeb5695da454
    

    我尝试了对 P1c1 进行直接相乘然后对 SECP256K1 的阶数p进行取余计算,使用的 JS 代码如下:

    import { utils } from "@noble/secp256k1"
    
    let p1Dot = utils.mod(BigInt("0xed714a5d314dc046d39e07966425d7615c18e4dc787eccd963109308f9b34e5e") * BigInt("0x2b9449f654043b1920e5e17d89bf20d9e6e3e449b2f49122621b18d7756a495d"));
    console.log(p1Dot.toString(16));
    

    utils.mod 是使用noble/secp256k1库中给出的求余函数

    得到的结果如下:

    5ef944a9320dfbae43c1eb50694bb64ada1698da111471fce4612ba24ee363dd
    

    显然与文章给出的结果不符,我想知道如何进行这种公钥乘法?代码如何实现?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3066 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 14:05 · PVG 22:05 · LAX 07:05 · JFK 10:05
    ♥ Do have faith in what you're doing.