Skip to content

Commit e073ee3

Browse files
committed
ecdsa: avoid 2-line if statements
1 parent 225cee8 commit e073ee3

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/ecdsa.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,21 @@ function deterministicGenerateK (curve, hash, d, checkSig) {
7575
}
7676

7777
function sign (curve, hash, d) {
78-
var r, s
79-
8078
var e = BigInteger.fromBuffer(hash)
8179
var n = curve.n
8280
var G = curve.G
8381

82+
var r, s
8483
deterministicGenerateK(curve, hash, d, function (k) {
8584
var Q = G.multiply(k)
8685

87-
if (curve.isInfinity(Q))
88-
return false
86+
if (curve.isInfinity(Q)) return false
8987

9088
r = Q.affineX.mod(n)
91-
if (r.signum() === 0)
92-
return false
89+
if (r.signum() === 0) return false
9390

9491
s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n)
95-
if (s.signum() === 0)
96-
return false
92+
if (s.signum() === 0) return false
9793

9894
return true
9995
})

0 commit comments

Comments
 (0)