猿问

如何在NIST P256 golang实现中计算p256Zero31?

我们发现有预定义的

// p256Zero31 is 0 mod p.
var p256Zero31 = [p256Limbs]uint32{two31m3, two30m2, two31m2, two30p13m2, two31m2, two30m2, two31p24m2, two30m27m2, two31m2}

在 crypto/elliptic/p256.go 中。p224.go有类似的var p224ZeroModP31。每次检查来自p224.go的引用。在 https://www.imperialviolet.org/2010/12/04/ecc.html。我们也找不到减部分“0 mod p”的细节。

我们也可以在openssl实现中找到这样的定义:https://github.com/openssl/openssl/blob/master/crypto/ec/ecp_nistp256.c

获得p256Zero31的fomula是什么?我计算了0x7ffff * p,它不等于p256Zero31。0x7ffff * p < p256Zero31 < 0x80000 * p


沧海一幻觉
浏览 177回答 1
1回答

临摹微笑

我终于找到了逻辑,p256Zero31&nbsp;=&nbsp;{two31,two30,two31,two30,two31,two30,two31,two30,two31}&nbsp;-&nbsp;{two31,two30,two31,two30,two31,two30,two31,two30,two31}&nbsp;mod&nbsp;P并将大Int转换为四肢。
随时随地看视频慕课网APP

相关分类

Go
我要回答