Skip to content

Commit a1c0301

Browse files
committed
Revert "fix more lint issues"
This reverts commit c276885.
1 parent 11e9888 commit a1c0301

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

ellipticcurve/math.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ var fromJacobian = function (p, P) {
8181
// :param P: Prime number in the module of the equation Y^2 = X^3 + A*X + B (mod p)
8282
// :return: Point in default coordinates
8383

84-
let z = inv(p.z, P);
84+
z = inv(p.z, P);
8585

8686
var point = new Point(
8787
modulo(p.x.multiply(z.pow(2)), P),
@@ -130,10 +130,10 @@ var jacobianAdd = function (p, q, A, P) {
130130
return p;
131131
}
132132

133-
let U1 = modulo(p.x.multiply(q.z.pow(2)), P);
134-
let U2 = modulo(q.x.multiply(p.z.pow(2)), P);
135-
let S1 = modulo(p.y.multiply(q.z.pow(3)), P);
136-
let S2 = modulo(q.y.multiply(p.z.pow(3)), P);
133+
U1 = modulo(p.x.multiply(q.z.pow(2)), P);
134+
U2 = modulo(q.x.multiply(p.z.pow(2)), P);
135+
S1 = modulo(p.y.multiply(q.z.pow(3)), P);
136+
S2 = modulo(q.y.multiply(p.z.pow(3)), P);
137137

138138
if (U1.eq(U2)) {
139139
if (S1.neq(S2)) {
@@ -142,14 +142,14 @@ var jacobianAdd = function (p, q, A, P) {
142142
return jacobianDouble(p, A, P);
143143
}
144144

145-
let H = U2.minus(U1);
146-
let R = S2.minus(S1);
147-
let H2 = modulo((H.multiply(H)), P);
148-
let H3 = modulo((H.multiply(H2)), P);
149-
let U1H2 = modulo((U1.multiply(H2)), P);
150-
let nx = modulo(((R.pow(2)).minus(H3).minus(U1H2.multiply(2))), P);
151-
let ny = modulo((R.multiply(U1H2.minus(nx)).minus(S1.multiply(H3))), P);
152-
let nz = modulo((H.multiply(p.z).multiply(q.z)), P);
145+
H = U2.minus(U1);
146+
R = S2.minus(S1);
147+
H2 = modulo((H.multiply(H)), P);
148+
H3 = modulo((H.multiply(H2)), P);
149+
U1H2 = modulo((U1.multiply(H2)), P);
150+
nx = modulo(((R.pow(2)).minus(H3).minus(U1H2.multiply(2))), P);
151+
ny = modulo((R.multiply(U1H2.minus(nx)).minus(S1.multiply(H3))), P);
152+
nz = modulo((H.multiply(p.z).multiply(q.z)), P);
153153

154154
return new Point(nx, ny, nz);
155155
};

ellipticcurve/utils/der.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const bytesHexF = Buffer.from(hexF).toString('binary');
2727
exports.encodeSequence = function () {
2828
let sequence = [];
2929
let totalLengthLen = 0;
30-
for (let i=0; i < arguments.length; i++) {
30+
for (i=0; i < arguments.length; i++) {
3131
sequence.push(arguments[i]);
3232
totalLengthLen += arguments[i].length;
3333
}
@@ -105,7 +105,7 @@ exports.removeSequence = function (string) {
105105
let length = result[0];
106106
let lengthLen = result[1];
107107

108-
let endSeq = 1 + lengthLen + length;
108+
endSeq = 1 + lengthLen + length;
109109

110110
return [string.slice(1 + lengthLen, endSeq), string.slice(endSeq)];
111111
}
@@ -185,20 +185,20 @@ exports.removeOctetString = function (string) {
185185
let length = result[0];
186186
let lengthLen = result[1];
187187

188-
let body = string.slice(1 + lengthLen, 1 + lengthLen + length);
189-
let rest = string.slice(1 + lengthLen + length);
188+
body = string.slice(1 + lengthLen, 1 + lengthLen + length);
189+
rest = string.slice(1 + lengthLen + length);
190190

191191
return [body, rest];
192192
}
193193

194194

195195
exports.removeConstructed = function (string) {
196-
let s0 = _extractFirstInt(string);
196+
s0 = _extractFirstInt(string);
197197
if ((s0 & hex224) != hex129) {
198198
throw new Error("wanted constructed tag (0xa0-0xbf), got 0x" + s0);
199199
}
200200

201-
let tag = s0 & hex31
201+
tag = s0 & hex31
202202
let result = _readLength(string.slice(1));
203203
let length = result[0];
204204
let lengthLen = result[1];
@@ -227,9 +227,9 @@ exports.fromPem = function (pem) {
227227

228228
exports.toPem = function (der, name) {
229229
let b64 = Base64.encode(der);
230-
let lines = [("-----BEGIN " + name + "-----\n")];
230+
lines = [("-----BEGIN " + name + "-----\n")];
231231

232-
for (let start = 0; start <= b64.length; start += 64) {
232+
for (start = 0; start <= b64.length; start += 64) {
233233
lines.push(b64.slice(start, start + 64) + "\n")
234234
}
235235
lines.push("-----END " + name + "-----\n");
@@ -281,7 +281,7 @@ function _encodeNumber (n) {
281281

282282

283283
function _readLength (string) {
284-
let num = _extractFirstInt(string);
284+
num = _extractFirstInt(string);
285285
if (!(num & hex160)) {
286286
return [(num & hex127), 1];
287287
}
@@ -300,7 +300,6 @@ function _readNumber (string) {
300300
let number = 0;
301301
let lengthLen = 0;
302302
let d;
303-
// eslint-disable-next-line no-constant-condition
304303
while (true) {
305304
if (lengthLen > string.length) {
306305
throw new Error("ran out of length bytes");

ellipticcurve/utils/integer.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// based on random-number-csprng: https://www.npmjs.com/package/random-number-csprng
2-
// noinspection JSUnusedLocalSymbols
32

43
const BigInt = require("big-integer");
54
const crypto = require("crypto");
@@ -67,7 +66,6 @@ function secureRandomNumber(minimum, maximum) { // bigint, bigint
6766

6867
let range = maximum.minus(minimum);
6968

70-
// eslint-disable-next-line no-unused-vars
7169
let {bitsNeeded, bytesNeeded, mask} = calculateParameters(range);
7270

7371
let randomBytes = crypto.randomBytes(bytesNeeded);

0 commit comments

Comments
 (0)