Skip to content

Commit bd8ddbb

Browse files
committed
Missing dependencies
1 parent ec7b8ee commit bd8ddbb

File tree

4 files changed

+189
-2
lines changed

4 files changed

+189
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ platforms/
88
plugins/
99
.sass-cache/
1010
.tmp/
11-
vendor/
11+
vendor/*
12+
!vendor/md5
1213
www/
1314
sublime/
1415
npm-debug.log

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"angular-local-storage": "~0.2.3",
1010
"jquery": "~2.2.0",
1111
"angular-cache": "~4.5.0",
12-
"karma-read-json": "^1.1.0"
12+
"karma-read-json": "^1.1.0",
13+
"restangular": "^1.5.1"
1314
},
1415
"resolutions": {
1516
"angular": "~1.4.9"

vendor/md5/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
= MD5
2+
3+
The file {{{md5.js}}} provides {{{md5()}}}, a slight modification of [[http://www.myersdaily.org/joseph/javascript/md5-text.html|Joseph Myers's high-performance function]]. Joseph's original functions have been wrapped in a self-invocating function so the only name added to the global namespace is {{{md5()}}}. In addition, the script will detect unicode and convert it to UTF-8 before hashing.
4+
5+
Due to the check for unicode and potential conversion to UTF-8, this function is slower that Joseph's original, but will produce identical results to server-side md5() functions executed on UTF-8-encoded text. There is a basic performance test at http://jsperf.com/md5-shootout.

vendor/md5/md5.js

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
/*!
2+
* Joseph Myer's md5() algorithm wrapped in a self-invoked function to prevent
3+
* global namespace polution, modified to hash unicode characters as UTF-8.
4+
*
5+
* Copyright 1999-2010, Joseph Myers, Paul Johnston, Greg Holt, Will Bond <will@wbond.net>
6+
* http://www.myersdaily.org/joseph/javascript/md5-text.html
7+
* http://pajhome.org.uk/crypt/md5
8+
*
9+
* Released under the BSD license
10+
* http://www.opensource.org/licenses/bsd-license
11+
*/
12+
(function() {
13+
function md5cycle(x, k) {
14+
var a = x[0], b = x[1], c = x[2], d = x[3];
15+
16+
a = ff(a, b, c, d, k[0], 7, -680876936);
17+
d = ff(d, a, b, c, k[1], 12, -389564586);
18+
c = ff(c, d, a, b, k[2], 17, 606105819);
19+
b = ff(b, c, d, a, k[3], 22, -1044525330);
20+
a = ff(a, b, c, d, k[4], 7, -176418897);
21+
d = ff(d, a, b, c, k[5], 12, 1200080426);
22+
c = ff(c, d, a, b, k[6], 17, -1473231341);
23+
b = ff(b, c, d, a, k[7], 22, -45705983);
24+
a = ff(a, b, c, d, k[8], 7, 1770035416);
25+
d = ff(d, a, b, c, k[9], 12, -1958414417);
26+
c = ff(c, d, a, b, k[10], 17, -42063);
27+
b = ff(b, c, d, a, k[11], 22, -1990404162);
28+
a = ff(a, b, c, d, k[12], 7, 1804603682);
29+
d = ff(d, a, b, c, k[13], 12, -40341101);
30+
c = ff(c, d, a, b, k[14], 17, -1502002290);
31+
b = ff(b, c, d, a, k[15], 22, 1236535329);
32+
33+
a = gg(a, b, c, d, k[1], 5, -165796510);
34+
d = gg(d, a, b, c, k[6], 9, -1069501632);
35+
c = gg(c, d, a, b, k[11], 14, 643717713);
36+
b = gg(b, c, d, a, k[0], 20, -373897302);
37+
a = gg(a, b, c, d, k[5], 5, -701558691);
38+
d = gg(d, a, b, c, k[10], 9, 38016083);
39+
c = gg(c, d, a, b, k[15], 14, -660478335);
40+
b = gg(b, c, d, a, k[4], 20, -405537848);
41+
a = gg(a, b, c, d, k[9], 5, 568446438);
42+
d = gg(d, a, b, c, k[14], 9, -1019803690);
43+
c = gg(c, d, a, b, k[3], 14, -187363961);
44+
b = gg(b, c, d, a, k[8], 20, 1163531501);
45+
a = gg(a, b, c, d, k[13], 5, -1444681467);
46+
d = gg(d, a, b, c, k[2], 9, -51403784);
47+
c = gg(c, d, a, b, k[7], 14, 1735328473);
48+
b = gg(b, c, d, a, k[12], 20, -1926607734);
49+
50+
a = hh(a, b, c, d, k[5], 4, -378558);
51+
d = hh(d, a, b, c, k[8], 11, -2022574463);
52+
c = hh(c, d, a, b, k[11], 16, 1839030562);
53+
b = hh(b, c, d, a, k[14], 23, -35309556);
54+
a = hh(a, b, c, d, k[1], 4, -1530992060);
55+
d = hh(d, a, b, c, k[4], 11, 1272893353);
56+
c = hh(c, d, a, b, k[7], 16, -155497632);
57+
b = hh(b, c, d, a, k[10], 23, -1094730640);
58+
a = hh(a, b, c, d, k[13], 4, 681279174);
59+
d = hh(d, a, b, c, k[0], 11, -358537222);
60+
c = hh(c, d, a, b, k[3], 16, -722521979);
61+
b = hh(b, c, d, a, k[6], 23, 76029189);
62+
a = hh(a, b, c, d, k[9], 4, -640364487);
63+
d = hh(d, a, b, c, k[12], 11, -421815835);
64+
c = hh(c, d, a, b, k[15], 16, 530742520);
65+
b = hh(b, c, d, a, k[2], 23, -995338651);
66+
67+
a = ii(a, b, c, d, k[0], 6, -198630844);
68+
d = ii(d, a, b, c, k[7], 10, 1126891415);
69+
c = ii(c, d, a, b, k[14], 15, -1416354905);
70+
b = ii(b, c, d, a, k[5], 21, -57434055);
71+
a = ii(a, b, c, d, k[12], 6, 1700485571);
72+
d = ii(d, a, b, c, k[3], 10, -1894986606);
73+
c = ii(c, d, a, b, k[10], 15, -1051523);
74+
b = ii(b, c, d, a, k[1], 21, -2054922799);
75+
a = ii(a, b, c, d, k[8], 6, 1873313359);
76+
d = ii(d, a, b, c, k[15], 10, -30611744);
77+
c = ii(c, d, a, b, k[6], 15, -1560198380);
78+
b = ii(b, c, d, a, k[13], 21, 1309151649);
79+
a = ii(a, b, c, d, k[4], 6, -145523070);
80+
d = ii(d, a, b, c, k[11], 10, -1120210379);
81+
c = ii(c, d, a, b, k[2], 15, 718787259);
82+
b = ii(b, c, d, a, k[9], 21, -343485551);
83+
84+
x[0] = add32(a, x[0]);
85+
x[1] = add32(b, x[1]);
86+
x[2] = add32(c, x[2]);
87+
x[3] = add32(d, x[3]);
88+
}
89+
90+
function cmn(q, a, b, x, s, t) {
91+
a = add32(add32(a, q), add32(x, t));
92+
return add32((a << s) | (a >>> (32 - s)), b);
93+
}
94+
95+
function ff(a, b, c, d, x, s, t) {
96+
return cmn((b & c) | ((~b) & d), a, b, x, s, t);
97+
}
98+
99+
function gg(a, b, c, d, x, s, t) {
100+
return cmn((b & d) | (c & (~d)), a, b, x, s, t);
101+
}
102+
103+
function hh(a, b, c, d, x, s, t) {
104+
return cmn(b ^ c ^ d, a, b, x, s, t);
105+
}
106+
107+
function ii(a, b, c, d, x, s, t) {
108+
return cmn(c ^ (b | (~d)), a, b, x, s, t);
109+
}
110+
111+
function md51(s) {
112+
// Converts the string to UTF-8 "bytes" when necessary
113+
if (/[\x80-\xFF]/.test(s)) {
114+
s = unescape(encodeURI(s));
115+
}
116+
txt = '';
117+
var n = s.length, state = [1732584193, -271733879, -1732584194, 271733878], i;
118+
for (i = 64; i <= s.length; i += 64) {
119+
md5cycle(state, md5blk(s.substring(i - 64, i)));
120+
}
121+
s = s.substring(i - 64);
122+
var tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
123+
for (i = 0; i < s.length; i++)
124+
tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);
125+
tail[i >> 2] |= 0x80 << ((i % 4) << 3);
126+
if (i > 55) {
127+
md5cycle(state, tail);
128+
for (i = 0; i < 16; i++) tail[i] = 0;
129+
}
130+
tail[14] = n * 8;
131+
md5cycle(state, tail);
132+
return state;
133+
}
134+
135+
function md5blk(s) { /* I figured global was faster. */
136+
var md5blks = [], i; /* Andy King said do it this way. */
137+
for (i = 0; i < 64; i += 4) {
138+
md5blks[i >> 2] = s.charCodeAt(i) +
139+
(s.charCodeAt(i + 1) << 8) +
140+
(s.charCodeAt(i + 2) << 16) +
141+
(s.charCodeAt(i + 3) << 24);
142+
}
143+
return md5blks;
144+
}
145+
146+
var hex_chr = '0123456789abcdef'.split('');
147+
148+
function rhex(n) {
149+
var s = '', j = 0;
150+
for (; j < 4; j++)
151+
s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] +
152+
hex_chr[(n >> (j * 8)) & 0x0F];
153+
return s;
154+
}
155+
156+
function hex(x) {
157+
for (var i = 0; i < x.length; i++)
158+
x[i] = rhex(x[i]);
159+
return x.join('');
160+
}
161+
162+
md5 = function (s) {
163+
return hex(md51(s));
164+
}
165+
166+
/* this function is much faster, so if possible we use it. Some IEs are the
167+
only ones I know of that need the idiotic second function, generated by an
168+
if clause. */
169+
function add32(a, b) {
170+
return (a + b) & 0xFFFFFFFF;
171+
}
172+
173+
if (md5('hello') != '5d41402abc4b2a76b9719d911017c592') {
174+
function add32(x, y) {
175+
var lsw = (x & 0xFFFF) + (y & 0xFFFF),
176+
msw = (x >> 16) + (y >> 16) + (lsw >> 16);
177+
return (msw << 16) | (lsw & 0xFFFF);
178+
}
179+
}
180+
})();

0 commit comments

Comments
 (0)