Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite71b2d9

Browse files
committed
lib: relint using eslint
1 parent8421a01 commite71b2d9

23 files changed

+6283
-7080
lines changed

‎.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test/lib

‎.eslintrc.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
module.exports={
2+
"env":{
3+
"node":true,
4+
"es6":true
5+
},
6+
"extends":[
7+
"eslint:recommended",
8+
],
9+
"globals":{
10+
"Atomics":"readonly",
11+
"SharedArrayBuffer":"readonly",
12+
"BigInt":"readonly",
13+
},
14+
"parserOptions":{
15+
"ecmaVersion":2020,
16+
"sourceType":"module",
17+
"ecmaFeatures":{
18+
"jsx":true
19+
}
20+
},
21+
"rules":{
22+
"indent":[
23+
"error",
24+
2
25+
],
26+
"linebreak-style":[
27+
"error",
28+
"unix"
29+
],
30+
"quotes":[
31+
"error",
32+
"single"
33+
],
34+
"semi":[
35+
"error",
36+
"always"
37+
],
38+
"array-bracket-spacing":["error","always"],
39+
"brace-style":["error"],
40+
"camelcase":["error"],
41+
"comma-spacing":["error"],
42+
"comma-style":["error"],
43+
"eol-last":["error"],
44+
"func-call-spacing":["error"],
45+
"func-name-matching":["error"],
46+
"no-multiple-empty-lines":["error"],
47+
"no-tabs":["error"],
48+
"no-trailing-spaces":["error"],
49+
"no-whitespace-before-property":["error"],
50+
"object-curly-newline":["error"],
51+
"object-curly-spacing":["error","always"],
52+
"padded-blocks":["error","never"],
53+
"quotes":["error","single",{"avoidEscape":true}],
54+
"semi-spacing":["error"],
55+
"semi-style":["error"],
56+
"space-before-blocks":["error"],
57+
"space-in-parens":["error"],
58+
"space-infix-ops":["error"],
59+
"space-unary-ops":["error"],
60+
"switch-colon-spacing":["error"],
61+
"comma-dangle":["error","always-multiline"],
62+
},
63+
"settings":{
64+
"react":{
65+
"version":"detect",
66+
},
67+
}
68+
};

‎.jscsrc

Lines changed: 0 additions & 46 deletions
This file was deleted.

‎.jshintrc

Lines changed: 0 additions & 89 deletions
This file was deleted.

‎lib/elliptic/curve/base.js

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,20 @@ BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
5959

6060
// Translate into more windowed form
6161
varrepr=[];
62-
for(varj=0;j<naf.length;j+=doubles.step){
63-
varnafW=0;
64-
for(vark=j+doubles.step-1;k>=j;k--)
65-
nafW=(nafW<<1)+naf[k];
62+
varj;
63+
varnafW;
64+
for(j=0;j<naf.length;j+=doubles.step){
65+
nafW=0;
66+
for(varl=j+doubles.step-1;l>=j;l--)
67+
nafW=(nafW<<1)+naf[l];
6668
repr.push(nafW);
6769
}
6870

6971
vara=this.jpoint(null,null,null);
7072
varb=this.jpoint(null,null,null);
7173
for(vari=I;i>0;i--){
72-
for(varj=0;j<repr.length;j++){
73-
varnafW=repr[j];
74+
for(j=0;j<repr.length;j++){
75+
nafW=repr[j];
7476
if(nafW===i)
7577
b=b.mixedAdd(doubles.points[j]);
7678
elseif(nafW===-i)
@@ -96,11 +98,11 @@ BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
9698
varacc=this.jpoint(null,null,null);
9799
for(vari=naf.length-1;i>=0;i--){
98100
// Count zeroes
99-
for(vark=0;i>=0&&naf[i]===0;i--)
100-
k++;
101+
for(varl=0;i>=0&&naf[i]===0;i--)
102+
l++;
101103
if(i>=0)
102-
k++;
103-
acc=acc.dblp(k);
104+
l++;
105+
acc=acc.dblp(l);
104106

105107
if(i<0)
106108
break;
@@ -124,25 +126,28 @@ BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
124126
};
125127

126128
BaseCurve.prototype._wnafMulAdd=function_wnafMulAdd(defW,
127-
points,
128-
coeffs,
129-
len,
130-
jacobianResult){
129+
points,
130+
coeffs,
131+
len,
132+
jacobianResult){
131133
varwndWidth=this._wnafT1;
132134
varwnd=this._wnafT2;
133135
varnaf=this._wnafT3;
134136

135137
// Fill all arrays
136138
varmax=0;
137-
for(vari=0;i<len;i++){
138-
varp=points[i];
139+
vari;
140+
varj;
141+
varp;
142+
for(i=0;i<len;i++){
143+
p=points[i];
139144
varnafPoints=p._getNAFPoints(defW);
140145
wndWidth[i]=nafPoints.wnd;
141146
wnd[i]=nafPoints.points;
142147
}
143148

144149
// Comb small window NAFs
145-
for(vari=len-1;i>=1;i-=2){
150+
for(i=len-1;i>=1;i-=2){
146151
vara=i-1;
147152
varb=i;
148153
if(wndWidth[a]!==1||wndWidth[b]!==1){
@@ -157,7 +162,7 @@ BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
157162
points[a],/* 1 */
158163
null,/* 3 */
159164
null,/* 5 */
160-
points[b]/* 7 */
165+
points[b],/* 7 */
161166
];
162167

163168
// Try to avoid Projective points, if possible
@@ -181,14 +186,14 @@ BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
181186
7,/* 0 1 */
182187
5,/* 1 -1 */
183188
1,/* 1 0 */
184-
3/* 1 1 */
189+
3,/* 1 1 */
185190
];
186191

187192
varjsf=getJSF(coeffs[a],coeffs[b]);
188193
max=Math.max(jsf[0].length,max);
189194
naf[a]=newArray(max);
190195
naf[b]=newArray(max);
191-
for(varj=0;j<max;j++){
196+
for(j=0;j<max;j++){
192197
varja=jsf[0][j]|0;
193198
varjb=jsf[1][j]|0;
194199

@@ -200,12 +205,12 @@ BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
200205

201206
varacc=this.jpoint(null,null,null);
202207
vartmp=this._wnafT4;
203-
for(vari=max;i>=0;i--){
208+
for(i=max;i>=0;i--){
204209
vark=0;
205210

206211
while(i>=0){
207212
varzero=true;
208-
for(varj=0;j<len;j++){
213+
for(j=0;j<len;j++){
209214
tmp[j]=naf[j][i]|0;
210215
if(tmp[j]!==0)
211216
zero=false;
@@ -221,9 +226,9 @@ BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
221226
if(i<0)
222227
break;
223228

224-
for(varj=0;j<len;j++){
229+
for(j=0;j<len;j++){
225230
varz=tmp[j];
226-
varp;
231+
p;
227232
if(z===0)
228233
continue;
229234
elseif(z>0)
@@ -238,7 +243,7 @@ BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
238243
}
239244
}
240245
// Zeroify references
241-
for(vari=0;i<len;i++)
246+
for(i=0;i<len;i++)
242247
wnd[i]=null;
243248

244249
if(jacobianResult)
@@ -276,7 +281,7 @@ BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
276281
assert(bytes[bytes.length-1]%2===1);
277282

278283
varres=this.point(bytes.slice(1,1+len),
279-
bytes.slice(1+len,1+2*len));
284+
bytes.slice(1+len,1+2*len));
280285

281286
returnres;
282287
}elseif((bytes[0]===0x02||bytes[0]===0x03)&&
@@ -297,7 +302,7 @@ BasePoint.prototype._encode = function _encode(compact) {
297302
if(compact)
298303
return[this.getY().isEven() ?0x02 :0x03].concat(x);
299304

300-
return[0x04].concat(x,this.getY().toArray('be',len));
305+
return[0x04].concat(x,this.getY().toArray('be',len));
301306
};
302307

303308
BasePoint.prototype.encode=functionencode(enc,compact){
@@ -311,7 +316,7 @@ BasePoint.prototype.precompute = function precompute(power) {
311316
varprecomputed={
312317
doubles:null,
313318
naf:null,
314-
beta:null
319+
beta:null,
315320
};
316321
precomputed.naf=this._getNAFPoints(8);
317322
precomputed.doubles=this._getDoubles(4,power);
@@ -345,7 +350,7 @@ BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
345350
}
346351
return{
347352
step:step,
348-
points:doubles
353+
points:doubles,
349354
};
350355
};
351356

@@ -360,7 +365,7 @@ BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
360365
res[i]=res[i-1].add(dbl);
361366
return{
362367
wnd:wnd,
363-
points:res
368+
points:res,
364369
};
365370
};
366371

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp