ecdsa: opt for shiftRight, pow and square
In the given situations, these offer better readability, or in the case of shiftRight, a substantial performance increase.
This commit is contained in:
parent
7d89ff427c
commit
5ec9504ed6
3 changed files with 10 additions and 10 deletions
test
|
@ -59,7 +59,8 @@ describe('ecdsa', function() {
|
|||
var psig = ecdsa.parseSig(signature)
|
||||
|
||||
// See BIP62 for more information
|
||||
assert(psig.s.compareTo(ecparams.getN().divide(BigInteger.valueOf(2))) <= 0)
|
||||
var N_OVER_TWO = ecparams.getN().shiftRight(1)
|
||||
assert(psig.s.compareTo(N_OVER_TWO) <= 0)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue