herumi / bls-wasm

BLS signature for Node.js by WebAssembly
47 stars 26 forks source link

LittleEndian #1

Closed janus closed 5 years ago

janus commented 5 years ago

Please what is the reason behind the use of LittleEndian during secret key generation.


      setLittleEndian (s) {
        this._setter(mod.blsSecretKeySetLittleEndian, s)
      }
      setByCSPRNG () {
        const a = new Uint8Array(BLS_SECRETKEY_SIZE)
        crypto.getRandomValues(a)
        this.setLittleEndian(a)
}```
herumi commented 5 years ago

The reason is that it ensures that the value is less than r.

janus commented 5 years ago

Thanks a million