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

Appearance settings

Commit 3ad4d47

Browse filesBrowse files
committed
Format code with prettier-eslint.
1 parent ff1999d commit 3ad4d47
Copy full SHA for 3ad4d47

File tree

Expand file treeCollapse file tree

3 files changed

+22
-48
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+22
-48
lines changed
Open diff view settings
Collapse file

‎js/md5.js‎

Copy file name to clipboardExpand all lines: js/md5.js
+11-12Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
* to work around bugs in some JS interpreters.
2828
*/
2929
function safeAdd (x, y) {
30-
var lsw = (x & 0xFFFF) + (y & 0xFFFF)
30+
var lsw = (x & 0xffff) + (y & 0xffff)
3131
var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
32-
return (msw << 16) | (lsw & 0xFFFF)
32+
return (msw << 16) | (lsw & 0xffff)
3333
}
3434

3535
/*
@@ -46,16 +46,16 @@
4646
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b)
4747
}
4848
function md5ff (a, b, c, d, x, s, t) {
49-
return md5cmn((b & c) | ((~b) & d), a, b, x, s, t)
49+
return md5cmn((b & c) | (~b & d), a, b, x, s, t)
5050
}
5151
function md5gg (a, b, c, d, x, s, t) {
52-
return md5cmn((b & d) | (c & (~d)), a, b, x, s, t)
52+
return md5cmn((b & d) | (c & ~d), a, b, x, s, t)
5353
}
5454
function md5hh (a, b, c, d, x, s, t) {
5555
return md5cmn(b ^ c ^ d, a, b, x, s, t)
5656
}
5757
function md5ii (a, b, c, d, x, s, t) {
58-
return md5cmn(c ^ (b | (~d)), a, b, x, s, t)
58+
return md5cmn(c ^ (b | ~d), a, b, x, s, t)
5959
}
6060

6161
/*
@@ -64,7 +64,7 @@
6464
function binlMD5 (x, len) {
6565
/* append padding */
6666
x[len >> 5] |= 0x80 << (len % 32)
67-
x[(((len + 64) >>> 9) << 4) + 14] = len
67+
x[((len + 64) >>> 9 << 4) + 14] = len
6868

6969
var i
7070
var olda
@@ -166,7 +166,7 @@
166166
var output = ''
167167
var length32 = input.length * 32
168168
for (i = 0; i < length32; i += 8) {
169-
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF)
169+
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff)
170170
}
171171
return output
172172
}
@@ -184,7 +184,7 @@
184184
}
185185
var length8 = input.length * 8
186186
for (i = 0; i < length8; i += 8) {
187-
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32)
187+
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32)
188188
}
189189
return output
190190
}
@@ -211,7 +211,7 @@
211211
}
212212
for (i = 0; i < 16; i += 1) {
213213
ipad[i] = bkey[i] ^ 0x36363636
214-
opad[i] = bkey[i] ^ 0x5C5C5C5C
214+
opad[i] = bkey[i] ^ 0x5c5c5c5c
215215
}
216216
hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8)
217217
return binl2rstr(binlMD5(opad.concat(hash), 512 + 128))
@@ -227,8 +227,7 @@
227227
var i
228228
for (i = 0; i < input.length; i += 1) {
229229
x = input.charCodeAt(i)
230-
output += hexTab.charAt((x >>> 4) & 0x0F) +
231-
hexTab.charAt(x & 0x0F)
230+
output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f)
232231
}
233232
return output
234233
}
@@ -278,4 +277,4 @@
278277
} else {
279278
$.md5 = md5
280279
}
281-
}(this))
280+
})(this)
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@
3232
"eslint-plugin-promise": "^3.5.0",
3333
"eslint-plugin-standard": "^3.0.1",
3434
"mocha": "^3.5.0",
35+
"prettier-eslint-cli": "^4.2.1",
3536
"uglify-js": "^3.0.28"
3637
},
3738
"scripts": {
39+
"format": "prettier-eslint --no-semi --single-quote --write **/*.js",
3840
"lint": "eslint .",
3941
"unit": "mocha",
4042
"test": "npm run lint && npm run unit",
Collapse file

‎test/test.js‎

Copy file name to clipboardExpand all lines: test/test.js
+9-36Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,76 +16,49 @@
1616

1717
describe('MD5 Hex-encoding', function () {
1818
it('should create a hex-encoded MD5 hash of an ASCII value', function () {
19-
expect(
20-
md5('value')
21-
).to.equal(
22-
'2063c1608d6e0baf80249c42e2be5804'
23-
)
19+
expect(md5('value')).to.equal('2063c1608d6e0baf80249c42e2be5804')
2420
})
2521

2622
it('should create a hex-encoded MD5 hash of an UTF-8 value', function () {
27-
expect(
28-
md5('日本')
29-
).to.equal(
30-
'4dbed2e657457884e67137d3514119b3'
31-
)
23+
expect(md5('日本')).to.equal('4dbed2e657457884e67137d3514119b3')
3224
})
3325
})
3426

3527
describe('HMAC-MD5 Hex-encoding', function () {
3628
it('should create a hex-encoded HMAC-MD5 hash of an ASCII value and key', function () {
37-
expect(
38-
md5('value', 'key')
39-
).to.equal(
40-
'01433efd5f16327ea4b31144572c67f6'
41-
)
29+
expect(md5('value', 'key')).to.equal('01433efd5f16327ea4b31144572c67f6')
4230
})
4331

4432
it('should create a hex-encoded HMAC-MD5 hash of an UTF-8 value and key', function () {
45-
expect(
46-
md5('日本', '日本')
47-
).to.equal(
48-
'c78b8c7357926981cc04740bd3e9d015'
49-
)
33+
expect(md5('日本', '日本')).to.equal('c78b8c7357926981cc04740bd3e9d015')
5034
})
5135
})
5236

5337
describe('MD5 raw encoding', function () {
5438
it('should create a raw MD5 hash of an ASCII value', function () {
55-
expect(
56-
md5('value', null, true)
57-
).to.equal(
39+
expect(md5('value', null, true)).to.equal(
5840
' c\xc1`\x8dn\x0b\xaf\x80$\x9cB\xe2\xbeX\x04'
5941
)
6042
})
6143

6244
it('should create a raw MD5 hash of an UTF-8 value', function () {
63-
expect(
64-
md5('日本', null, true)
65-
).to.equal(
45+
expect(md5('日本', null, true)).to.equal(
6646
'M\xbe\xd2\xe6WEx\x84\xe6q7\xd3QA\x19\xb3'
6747
)
6848
})
6949
})
7050

7151
describe('HMAC-MD5 raw encoding', function () {
7252
it('should create a raw HMAC-MD5 hash of an ASCII value and key', function () {
73-
expect(
74-
md5('value', 'key', true)
75-
).to.equal(
53+
expect(md5('value', 'key', true)).to.equal(
7654
'\x01C>\xfd_\x162~\xa4\xb3\x11DW,g\xf6'
7755
)
7856
})
7957

8058
it('should create a raw HMAC-MD5 hash of an UTF-8 value and key', function () {
81-
expect(
82-
md5('日本', '日本', true)
83-
).to.equal(
59+
expect(md5('日本', '日本', true)).to.equal(
8460
'\xc7\x8b\x8csW\x92i\x81\xcc\x04t\x0b\xd3\xe9\xd0\x15'
8561
)
8662
})
8763
})
88-
}(
89-
(this.chai || require('chai')).expect,
90-
this.md5 || require('../js/md5')
91-
))
64+
})((this.chai || require('chai')).expect, this.md5 || require('../js/md5'))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.