You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
h := blake2b.Sum512(seed[:])
for i := 0; i < 32; i++ {
priv.randSrc[i] = h[i+32]
}
// prune the key
// https://tools.ietf.org/html/rfc8032#section-5.1.5, key generation
h[0] &= 0xF8
h[31] &= 0x7F
h[31] |= 0x40
// reverse first bytes because setBytes interpret stream as big endian
// but in eddsa specs s is the first 32 bytes in little endian
for i, j := 0, sizeFr; i < j; i, j = i+1, j-1 {
h[i], h[j] = h[j], h[i]
}
explanation
h is [64]byte, and in eddsah[:32] is scalar and h[32:] is random source.
As the annotation describes, if reverse first bytes because setBytes interpret stream as big endian.
We should swap h[0] with h[31] but not h[sizeFr] = h[32].
Please correct me if I understand wrongly. I can create a pr for this issue later.
The text was updated successfully, but these errors were encountered:
https://github.com/ConsenSys/gnark-crypto/blob/master/ecc/bn254/twistededwards/eddsa/eddsa.go#L89
code reference
explanation
h
is[64]byte
, and ineddsa
h[:32]
is scalar andh[32:]
is random source.As the annotation describes, if
reverse first bytes because setBytes interpret stream as big endian
.We should swap
h[0]
withh[31]
but noth[sizeFr] = h[32]
.Please correct me if I understand wrongly. I can create a pr for this issue later.
The text was updated successfully, but these errors were encountered: