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:
Daniel Cousens 2014-05-17 12:05:05 +10:00
parent 7d89ff427c
commit 5ec9504ed6
3 changed files with 10 additions and 10 deletions

View file

@ -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)
})
})