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

Commit9a76e2f

Browse files
committed
[lint] fix whitespace
1 parent89694cf commit9a76e2f

File tree

14 files changed

+817
-822
lines changed

14 files changed

+817
-822
lines changed

‎.eslintrc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
"curly": "warn",
2222
"dot-notation": [2, { "allowKeywords": true, "allowPattern": "throws" }],
2323
"func-style": "warn",
24-
"function-paren-newline": "warn",
2524
"id-denylist": "warn",
26-
"indent": ["error", 2],
2725
"max-params": "warn",
2826
"max-statements-per-line": "warn",
2927
"multiline-comment-style": "off",
@@ -33,7 +31,6 @@
3331
"no-use-before-define": "warn",
3432
"semi": ["error", "never"],
3533
"sort-keys": "warn",
36-
"space-before-function-paren": "warn",
3734
"strict": "warn",
3835
},
3936

@@ -48,7 +45,6 @@
4845
"rules": {
4946
"curly": "warn",
5047
"func-style": "warn",
51-
"indent": ["error", 2],
5248
"max-params": "warn",
5349
"no-extra-parens": "warn",
5450
"no-mixed-operators": "warn",
@@ -58,7 +54,6 @@
5854
"prefer-arrow-callback": "off",
5955
"prefer-template": "off",
6056
"semi": ["error", "never"],
61-
"space-before-function-paren": "warn",
6257
"strict": "warn",
6358
},
6459
},

‎README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ var derivedKey = pbkdf2.pbkdf2Sync('password', 'salt', 1, 32, 'sha512')
1818
...
1919
```
2020

21-
For more information on the API,please see the relevant[Node documentation](https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback).
21+
For more information on the API, please see the relevant[Node documentation](https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback).
2222

23-
For high performance,use the`async` variant (`pbkdf2.pbkdf2`),not`pbkdf2.pbkdf2Sync`, this variant has the oppurtunity to use`window.crypto.subtle` when browserified.
23+
For high performance, use the`async` variant (`pbkdf2.pbkdf2`), not`pbkdf2.pbkdf2Sync`; this variant has the oppurtunity to use`window.crypto.subtle` when browserified.
2424

2525

2626
##Credits

‎bench/index.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@ run('hello', 'world', 100, 32, 'md5')
66
run('hello','world',100,32,'sha256')
77
run('hello','world',10000,70,'md5')
88
run('hello','world',10000,70,'sha256')
9-
functionrun(password,salt,iterations,keylen,digest){
10-
varsuite=newBenchmark.Suite()
11-
console.log(`password:${password}`)
12-
console.log(`salt:${salt}`)
13-
console.log(`iterations:${iterations}`)
14-
console.log(`keylen:${keylen}`)
15-
console.log(`digest:${digest}`)
9+
functionrun(password,salt,iterations,keylen,digest){
10+
varsuite=newBenchmark.Suite()
11+
console.log(`password:${password}`)
12+
console.log(`salt:${salt}`)
13+
console.log(`iterations:${iterations}`)
14+
console.log(`keylen:${keylen}`)
15+
console.log(`digest:${digest}`)
1616

17-
// add tests
18-
suite
19-
.add('current',function(){
20-
current(password,salt,iterations,keylen,digest)
21-
})
22-
.add('old',function(){
23-
old(password,salt,iterations,keylen,digest)
24-
})
17+
// add tests
18+
suite
19+
.add('current',function(){
20+
current(password,salt,iterations,keylen,digest)
21+
})
22+
.add('old',function(){
23+
old(password,salt,iterations,keylen,digest)
24+
})
2525

26-
// add listeners
27-
.on('cycle',function(event){
28-
console.log(String(event.target))
29-
})
30-
.on('complete',function(){
31-
console.log('Fastest is '+this.filter('fastest').map('name'))
32-
console.log('')
33-
})
34-
.run()
26+
// add listeners
27+
.on('cycle',function(event){
28+
console.log(String(event.target))
29+
})
30+
.on('complete',function(){
31+
console.log('Fastest is '+this.filter('fastest').map('name'))
32+
console.log('')
33+
})
34+
.run()
3535
}

‎bench/old.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,45 @@ var checkParameters = require('../lib/precondition')
33
vardefaultEncoding=require('../lib/default-encoding')
44
varBuffer=require('safe-buffer').Buffer
55
module.exports=pbkdf2
6-
functionpbkdf2(password,salt,iterations,keylen,digest){
7-
if(!Buffer.isBuffer(password))password=Buffer.from(password,defaultEncoding)
8-
if(!Buffer.isBuffer(salt))salt=Buffer.from(salt,defaultEncoding)
6+
functionpbkdf2(password,salt,iterations,keylen,digest){
7+
if(!Buffer.isBuffer(password))password=Buffer.from(password,defaultEncoding)
8+
if(!Buffer.isBuffer(salt))salt=Buffer.from(salt,defaultEncoding)
99

10-
checkParameters(iterations,keylen)
10+
checkParameters(iterations,keylen)
1111

12-
digest=digest||'sha1'
12+
digest=digest||'sha1'
1313

14-
varhLen
15-
varl=1
16-
varDK=Buffer.allocUnsafe(keylen)
17-
varblock1=Buffer.allocUnsafe(salt.length+4)
18-
salt.copy(block1,0,0,salt.length)
14+
varhLen
15+
varl=1
16+
varDK=Buffer.allocUnsafe(keylen)
17+
varblock1=Buffer.allocUnsafe(salt.length+4)
18+
salt.copy(block1,0,0,salt.length)
1919

20-
varr
21-
varT
20+
varr
21+
varT
2222

23-
for(vari=1;i<=l;i++){
24-
block1.writeUInt32BE(i,salt.length)
25-
varU=createHmac(digest,password).update(block1).digest()
23+
for(vari=1;i<=l;i++){
24+
block1.writeUInt32BE(i,salt.length)
25+
varU=createHmac(digest,password).update(block1).digest()
2626

27-
if(!hLen){
28-
hLen=U.length
29-
T=Buffer.allocUnsafe(hLen)
30-
l=Math.ceil(keylen/hLen)
31-
r=keylen-(l-1)*hLen
32-
}
27+
if(!hLen){
28+
hLen=U.length
29+
T=Buffer.allocUnsafe(hLen)
30+
l=Math.ceil(keylen/hLen)
31+
r=keylen-(l-1)*hLen
32+
}
3333

34-
U.copy(T,0,0,hLen)
34+
U.copy(T,0,0,hLen)
3535

36-
for(varj=1;j<iterations;j++){
37-
U=createHmac(digest,password).update(U).digest()
38-
for(vark=0;k<hLen;k++)T[k]^=U[k]
39-
}
36+
for(varj=1;j<iterations;j++){
37+
U=createHmac(digest,password).update(U).digest()
38+
for(vark=0;k<hLen;k++)T[k]^=U[k]
39+
}
4040

41-
vardestPos=(i-1)*hLen
42-
varlen=(i===l ?r :hLen)
43-
T.copy(DK,destPos,0,len)
44-
}
41+
vardestPos=(i-1)*hLen
42+
varlen=(i===l ?r :hLen)
43+
T.copy(DK,destPos,0,len)
44+
}
4545

46-
returnDK
46+
returnDK
4747
}

‎index.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,35 @@ var defaultEncoding = require('./lib/default-encoding')
55
vartoBuffer=require('./lib/to-buffer')
66

77
functionnativePBKDF2(password,salt,iterations,keylen,digest,callback){
8-
checkParameters(iterations,keylen)
9-
password=toBuffer(password,defaultEncoding,'Password')
10-
salt=toBuffer(salt,defaultEncoding,'Salt')
8+
checkParameters(iterations,keylen)
9+
password=toBuffer(password,defaultEncoding,'Password')
10+
salt=toBuffer(salt,defaultEncoding,'Salt')
1111

12-
if(typeofdigest==='function'){
13-
callback=digest
14-
digest='sha1'
15-
}
16-
if(typeofcallback!=='function'){thrownewError('No callback provided to pbkdf2')}
12+
if(typeofdigest==='function'){
13+
callback=digest
14+
digest='sha1'
15+
}
16+
if(typeofcallback!=='function'){thrownewError('No callback provided to pbkdf2')}
1717

18-
returnnative.pbkdf2(password,salt,iterations,keylen,digest,callback)
18+
returnnative.pbkdf2(password,salt,iterations,keylen,digest,callback)
1919
}
2020

2121
functionnativePBKDF2Sync(password,salt,iterations,keylen,digest){
22-
checkParameters(iterations,keylen)
23-
password=toBuffer(password,defaultEncoding,'Password')
24-
salt=toBuffer(salt,defaultEncoding,'Salt')
25-
digest=digest||'sha1'
26-
returnnative.pbkdf2Sync(password,salt,iterations,keylen,digest)
22+
checkParameters(iterations,keylen)
23+
password=toBuffer(password,defaultEncoding,'Password')
24+
salt=toBuffer(salt,defaultEncoding,'Salt')
25+
digest=digest||'sha1'
26+
returnnative.pbkdf2Sync(password,salt,iterations,keylen,digest)
2727
}
2828

2929
/* istanbul ignore next */
3030
if(!native.pbkdf2Sync||native.pbkdf2Sync.toString().indexOf('keylen, digest')===-1){
31-
/* eslint global-require: 0 */
32-
exports.pbkdf2Sync=require('./lib/sync')
33-
exports.pbkdf2=require('./lib/async')
31+
/* eslint global-require: 0 */
32+
exports.pbkdf2Sync=require('./lib/sync')
33+
exports.pbkdf2=require('./lib/async')
3434

3535
// native
3636
}else{
37-
exports.pbkdf2Sync=nativePBKDF2Sync
38-
exports.pbkdf2=nativePBKDF2
37+
exports.pbkdf2Sync=nativePBKDF2Sync
38+
exports.pbkdf2=nativePBKDF2
3939
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp