Closed mhewett-ks closed 5 years ago
However, deserializeHexStrToFp limits the number to 256 bits.
The elliptic curve is defined over Fp and the order of the curve is r. For BLS12-381, |p| = 381 and |r| = 255. see https://github.com/herumi/mcl#curve-parameter .
What I actually want to generate is a random number in [0..p)
Please use setByCSPRNG().
let a = new mcl.Fr()
a.setByCSPRNG()
a.getStr()
"3030761079396743944577226857910186964859260808529341867926635497195550768241"
Is Fp supposed to be a number in the range [0..p] where p defines the modular field of the elliptic curve? In BLS12-381, p is 381 bits long so Fp should also be 381 bits long. However, deserializeHexStrToFp limits the number to 256 bits.
What I actually want to generate is a random number in [0..p). Does mcl-wasm provide a function to do that?