@mjhls/mjh-framework 1.0.811 → 1.0.812

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9846,6 +9846,8 @@ var MediaSeriesLanding = function MediaSeriesLanding(props) {
9846
9846
 
9847
9847
  MediaSeriesLanding.getInitialData = function () {
9848
9848
  var _ref3 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(ctx, client, cache) {
9849
+ var _ref4;
9850
+
9849
9851
  var urlQuery, pathname, identifier, itemsPerPage, currentPage, start, statusCode, params, docGroupID, seriesQuery, seriesData, allSeries, buildUsedTopicsArray, usedTopics, taxonomyFilter;
9850
9852
  return regenerator.wrap(function _callee2$(_context2) {
9851
9853
  while (1) {
@@ -9864,11 +9866,11 @@ MediaSeriesLanding.getInitialData = function () {
9864
9866
  url: pathname
9865
9867
  };
9866
9868
  _context2.next = 9;
9867
- return client.fetch('*[_type == \'documentGroup\' && identifier.current == \'' + identifier + '\'][0]{\n _id, \n name\n }');
9869
+ return client.fetch('*[_type == \'documentGroup\' && identifier.current == \'' + identifier + '\'][0]{\n _id, \n isGated,\n name\n }');
9868
9870
 
9869
9871
  case 9:
9870
9872
  docGroupID = _context2.sent;
9871
- seriesQuery = '*[_type == \'documentGroup\' && references(\'' + docGroupID._id + '\') && isSeries != false && isShow != false && defined(published) && dateTime(published) <= dateTime(now()) ] | order(published desc) [$from...$to] {\n _id,\n name,\n identifier,\n published,\n thumbnail,\n description,\n topicMapping[]->,\n \'pageNumber\': ' + currentPage + ',\n \'parentUrl\': \'' + identifier + '\'\n }';
9873
+ seriesQuery = '*[_type == \'documentGroup\' && references(\'' + docGroupID._id + '\') && isSeries != false && isShow != false && defined(published) && dateTime(published) <= dateTime(now()) ] | order(published desc) [$from...$to] {\n _id,\n name,\n identifier,\n published,\n thumbnail,\n description,\n topicMapping[]->,\n isGated,\n \'pageNumber\': ' + currentPage + ',\n \'parentUrl\': \'' + identifier + '\'\n }';
9872
9874
  _context2.next = 13;
9873
9875
  return client.fetch(seriesQuery, params);
9874
9876
 
@@ -9930,17 +9932,7 @@ MediaSeriesLanding.getInitialData = function () {
9930
9932
  statusCode = 404;
9931
9933
  }
9932
9934
 
9933
- return _context2.abrupt('return', _defineProperty({
9934
- seriesData: seriesData,
9935
- query: seriesQuery,
9936
- params: params,
9937
- currentPage: currentPage,
9938
- taxonomyFilter: taxonomyFilter,
9939
- identifier: identifier,
9940
- docGroupID: docGroupID._id,
9941
- parentUrl: identifier,
9942
- statusCode: statusCode
9943
- }, 'taxonomyFilter', taxonomyFilter));
9935
+ return _context2.abrupt('return', (_ref4 = { seriesData: seriesData, query: seriesQuery, params: params, currentPage: currentPage, taxonomyFilter: taxonomyFilter, identifier: identifier, docGroupID: docGroupID._id, parentUrl: identifier, statusCode: statusCode }, _defineProperty(_ref4, 'taxonomyFilter', taxonomyFilter), _defineProperty(_ref4, 'docGroup', docGroupID), _ref4));
9944
9936
 
9945
9937
  case 25:
9946
9938
  case 'end':
@@ -0,0 +1,321 @@
1
+ import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-7f8f9219.js';
2
+ import { m as md5 } from './md5-4e42248e.js';
3
+ import './_commonjsHelpers-0c4b6f40.js';
4
+ import './es6.string.iterator-bc33758b.js';
5
+ import './_to-object-b50e61c3.js';
6
+ import './web.dom.iterable-4109ff68.js';
7
+ import './_library-528f1934.js';
8
+ import './core.get-iterator-method-133dfacd.js';
9
+ import './_iter-detect-7e5e5ce2.js';
10
+
11
+ var encrypt = function () {
12
+ var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(password) {
13
+ var hash;
14
+ return regenerator.wrap(function _callee$(_context) {
15
+ while (1) {
16
+ switch (_context.prev = _context.next) {
17
+ case 0:
18
+ hash = md5(password);
19
+ return _context.abrupt('return', hash);
20
+
21
+ case 2:
22
+ case 'end':
23
+ return _context.stop();
24
+ }
25
+ }
26
+ }, _callee, this);
27
+ }));
28
+
29
+ return function encrypt(_x) {
30
+ return _ref.apply(this, arguments);
31
+ };
32
+ }();
33
+
34
+ var comparePassword = function () {
35
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(plainTextPassword, hashedPassword) {
36
+ var hash;
37
+ return regenerator.wrap(function _callee2$(_context2) {
38
+ while (1) {
39
+ switch (_context2.prev = _context2.next) {
40
+ case 0:
41
+ hash = md5(plainTextPassword);
42
+ return _context2.abrupt('return', hash === hashedPassword);
43
+
44
+ case 2:
45
+ case 'end':
46
+ return _context2.stop();
47
+ }
48
+ }
49
+ }, _callee2, this);
50
+ }));
51
+
52
+ return function comparePassword(_x2, _x3) {
53
+ return _ref2.apply(this, arguments);
54
+ };
55
+ }();
56
+
57
+ var faunadb = require('faunadb'),
58
+ q = faunadb.query;
59
+
60
+ var registerUser = function () {
61
+ var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(body) {
62
+ var secret = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'fnAEG3Bb7AACAC0BiSQFYGBLFUtHjn3QOTKE1iBX';
63
+ var data, client, hashedPassword, result;
64
+ return regenerator.wrap(function _callee$(_context) {
65
+ while (1) {
66
+ switch (_context.prev = _context.next) {
67
+ case 0:
68
+ _context.prev = 0;
69
+ data = body;
70
+
71
+ if (secret) {
72
+ _context.next = 4;
73
+ break;
74
+ }
75
+
76
+ throw new Error('Missing secret key');
77
+
78
+ case 4:
79
+ client = new faunadb.Client({ secret: secret });
80
+ _context.next = 7;
81
+ return encrypt(data.Password);
82
+
83
+ case 7:
84
+ hashedPassword = _context.sent;
85
+
86
+ data.Password = hashedPassword;
87
+
88
+ _context.next = 11;
89
+ return client.query(q.Create(q.Collection('Users'), {
90
+ data: data
91
+ }));
92
+
93
+ case 11:
94
+ result = _context.sent;
95
+
96
+ if (!(!result || !result.data || result.data.Email != data.Email)) {
97
+ _context.next = 14;
98
+ break;
99
+ }
100
+
101
+ throw new Error('Failed to register!');
102
+
103
+ case 14:
104
+ return _context.abrupt('return', result);
105
+
106
+ case 17:
107
+ _context.prev = 17;
108
+ _context.t0 = _context['catch'](0);
109
+ return _context.abrupt('return', { error: _context.t0.message });
110
+
111
+ case 20:
112
+ case 'end':
113
+ return _context.stop();
114
+ }
115
+ }
116
+ }, _callee, this, [[0, 17]]);
117
+ }));
118
+
119
+ return function registerUser(_x) {
120
+ return _ref.apply(this, arguments);
121
+ };
122
+ }();
123
+
124
+ var findUserByEmail = function () {
125
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(email) {
126
+ var secret = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'fnAEG3Bb7AACAC0BiSQFYGBLFUtHjn3QOTKE1iBX';
127
+ var client, result;
128
+ return regenerator.wrap(function _callee2$(_context2) {
129
+ while (1) {
130
+ switch (_context2.prev = _context2.next) {
131
+ case 0:
132
+ _context2.prev = 0;
133
+ client = new faunadb.Client({ secret: secret });
134
+ _context2.next = 4;
135
+ return client.query(q.Get(q.Match(q.Index('Email'), email)));
136
+
137
+ case 4:
138
+ result = _context2.sent;
139
+ return _context2.abrupt('return', result ? true : false);
140
+
141
+ case 8:
142
+ _context2.prev = 8;
143
+ _context2.t0 = _context2['catch'](0);
144
+ return _context2.abrupt('return', false);
145
+
146
+ case 11:
147
+ case 'end':
148
+ return _context2.stop();
149
+ }
150
+ }
151
+ }, _callee2, this, [[0, 8]]);
152
+ }));
153
+
154
+ return function findUserByEmail(_x3) {
155
+ return _ref2.apply(this, arguments);
156
+ };
157
+ }();
158
+
159
+ var authenticateUser = function () {
160
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(email, password) {
161
+ var secret = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'fnAEG3Bb7AACAC0BiSQFYGBLFUtHjn3QOTKE1iBX';
162
+ var client, result, hashedPassword, isAuth;
163
+ return regenerator.wrap(function _callee3$(_context3) {
164
+ while (1) {
165
+ switch (_context3.prev = _context3.next) {
166
+ case 0:
167
+ _context3.prev = 0;
168
+ client = new faunadb.Client({ secret: secret });
169
+ _context3.next = 4;
170
+ return client.query(q.Get(q.Match(q.Index('Email'), email)));
171
+
172
+ case 4:
173
+ result = _context3.sent;
174
+ hashedPassword = result.data.Password;
175
+ _context3.next = 8;
176
+ return comparePassword(password, hashedPassword);
177
+
178
+ case 8:
179
+ isAuth = _context3.sent;
180
+ return _context3.abrupt('return', isAuth ? { email: email } : false);
181
+
182
+ case 12:
183
+ _context3.prev = 12;
184
+ _context3.t0 = _context3['catch'](0);
185
+
186
+ console.log(_context3.t0);
187
+ return _context3.abrupt('return', false);
188
+
189
+ case 16:
190
+ case 'end':
191
+ return _context3.stop();
192
+ }
193
+ }
194
+ }, _callee3, this, [[0, 12]]);
195
+ }));
196
+
197
+ return function authenticateUser(_x5, _x6) {
198
+ return _ref3.apply(this, arguments);
199
+ };
200
+ }();
201
+
202
+ var updateUserSecret = function () {
203
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(email, hash) {
204
+ var secret = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'fnAEG3Bb7AACAC0BiSQFYGBLFUtHjn3QOTKE1iBX';
205
+ var expiration, client, result;
206
+ return regenerator.wrap(function _callee4$(_context4) {
207
+ while (1) {
208
+ switch (_context4.prev = _context4.next) {
209
+ case 0:
210
+ expiration = new Date().getTime() + 43200000; //1day
211
+
212
+ _context4.prev = 1;
213
+
214
+ console.log(email, hash, expiration);
215
+ client = new faunadb.Client({ secret: secret });
216
+ _context4.next = 6;
217
+ return client.query(q.Update(q.Select(['ref'], q.Get(q.Match(q.Index('Email'), email))), { data: { secretKey: hash, secretExpiration: expiration } }));
218
+
219
+ case 6:
220
+ result = _context4.sent;
221
+ return _context4.abrupt('return', result ? true : false);
222
+
223
+ case 10:
224
+ _context4.prev = 10;
225
+ _context4.t0 = _context4['catch'](1);
226
+
227
+ console.log(_context4.t0);
228
+ return _context4.abrupt('return', false);
229
+
230
+ case 14:
231
+ case 'end':
232
+ return _context4.stop();
233
+ }
234
+ }
235
+ }, _callee4, this, [[1, 10]]);
236
+ }));
237
+
238
+ return function updateUserSecret(_x8, _x9) {
239
+ return _ref4.apply(this, arguments);
240
+ };
241
+ }();
242
+
243
+ var updateUserPassword = function () {
244
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee5(hash, newPassword) {
245
+ var secret = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'fnAEG3Bb7AACAC0BiSQFYGBLFUtHjn3QOTKE1iBX';
246
+ var now, client, result, expiration, password, updatePassword;
247
+ return regenerator.wrap(function _callee5$(_context5) {
248
+ while (1) {
249
+ switch (_context5.prev = _context5.next) {
250
+ case 0:
251
+ _context5.prev = 0;
252
+ now = Date.now();
253
+ client = new faunadb.Client({ secret: secret });
254
+ _context5.next = 5;
255
+ return client.query(q.Get(q.Match(q.Index('SecretKey'), hash)));
256
+
257
+ case 5:
258
+ result = _context5.sent;
259
+ expiration = result.data.secretExpiration;
260
+
261
+ if (!(now > expiration)) {
262
+ _context5.next = 9;
263
+ break;
264
+ }
265
+
266
+ throw new Error('eKey has expired.');
267
+
268
+ case 9:
269
+ if (!(now < expiration)) {
270
+ _context5.next = 18;
271
+ break;
272
+ }
273
+
274
+ _context5.next = 12;
275
+ return encrypt(newPassword);
276
+
277
+ case 12:
278
+ password = _context5.sent;
279
+ _context5.next = 15;
280
+ return client.query(q.Update(q.Select(['ref'], q.Get(q.Match(q.Index('SecretKey'), hash))), { data: { Password: password, secretKey: '' } }));
281
+
282
+ case 15:
283
+ updatePassword = _context5.sent;
284
+
285
+ if (updatePassword) {
286
+ _context5.next = 18;
287
+ break;
288
+ }
289
+
290
+ throw new Error('Failed to update password.');
291
+
292
+ case 18:
293
+ if (!(!result || result.error)) {
294
+ _context5.next = 20;
295
+ break;
296
+ }
297
+
298
+ throw new Error('User not found');
299
+
300
+ case 20:
301
+ return _context5.abrupt('return', true);
302
+
303
+ case 23:
304
+ _context5.prev = 23;
305
+ _context5.t0 = _context5['catch'](0);
306
+ return _context5.abrupt('return', { err: _context5.t0 });
307
+
308
+ case 26:
309
+ case 'end':
310
+ return _context5.stop();
311
+ }
312
+ }
313
+ }, _callee5, this, [[0, 23]]);
314
+ }));
315
+
316
+ return function updateUserPassword(_x11, _x12) {
317
+ return _ref5.apply(this, arguments);
318
+ };
319
+ }();
320
+
321
+ export { authenticateUser, findUserByEmail, registerUser, updateUserPassword, updateUserSecret };
package/dist/esm/index.js CHANGED
@@ -183,6 +183,7 @@ import './index-db3bb315.js';
183
183
  import 'swr';
184
184
  import 'passport-local';
185
185
  import 'mysql';
186
+ import './md5-4e42248e.js';
186
187
  import './SeriesSlider-c8477bf3.js';
187
188
  import './style-inject.es-1f59c1d0.js';
188
189
  import 'disqus-react';
@@ -0,0 +1,321 @@
1
+ import { c as createCommonjsModule } from './_commonjsHelpers-0c4b6f40.js';
2
+
3
+ var crypt = createCommonjsModule(function (module) {
4
+ (function() {
5
+ var base64map
6
+ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
7
+
8
+ crypt = {
9
+ // Bit-wise rotation left
10
+ rotl: function(n, b) {
11
+ return (n << b) | (n >>> (32 - b));
12
+ },
13
+
14
+ // Bit-wise rotation right
15
+ rotr: function(n, b) {
16
+ return (n << (32 - b)) | (n >>> b);
17
+ },
18
+
19
+ // Swap big-endian to little-endian and vice versa
20
+ endian: function(n) {
21
+ // If number given, swap endian
22
+ if (n.constructor == Number) {
23
+ return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
24
+ }
25
+
26
+ // Else, assume array and swap all items
27
+ for (var i = 0; i < n.length; i++)
28
+ n[i] = crypt.endian(n[i]);
29
+ return n;
30
+ },
31
+
32
+ // Generate an array of any length of random bytes
33
+ randomBytes: function(n) {
34
+ for (var bytes = []; n > 0; n--)
35
+ bytes.push(Math.floor(Math.random() * 256));
36
+ return bytes;
37
+ },
38
+
39
+ // Convert a byte array to big-endian 32-bit words
40
+ bytesToWords: function(bytes) {
41
+ for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
42
+ words[b >>> 5] |= bytes[i] << (24 - b % 32);
43
+ return words;
44
+ },
45
+
46
+ // Convert big-endian 32-bit words to a byte array
47
+ wordsToBytes: function(words) {
48
+ for (var bytes = [], b = 0; b < words.length * 32; b += 8)
49
+ bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
50
+ return bytes;
51
+ },
52
+
53
+ // Convert a byte array to a hex string
54
+ bytesToHex: function(bytes) {
55
+ for (var hex = [], i = 0; i < bytes.length; i++) {
56
+ hex.push((bytes[i] >>> 4).toString(16));
57
+ hex.push((bytes[i] & 0xF).toString(16));
58
+ }
59
+ return hex.join('');
60
+ },
61
+
62
+ // Convert a hex string to a byte array
63
+ hexToBytes: function(hex) {
64
+ for (var bytes = [], c = 0; c < hex.length; c += 2)
65
+ bytes.push(parseInt(hex.substr(c, 2), 16));
66
+ return bytes;
67
+ },
68
+
69
+ // Convert a byte array to a base-64 string
70
+ bytesToBase64: function(bytes) {
71
+ for (var base64 = [], i = 0; i < bytes.length; i += 3) {
72
+ var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
73
+ for (var j = 0; j < 4; j++)
74
+ if (i * 8 + j * 6 <= bytes.length * 8)
75
+ base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
76
+ else
77
+ base64.push('=');
78
+ }
79
+ return base64.join('');
80
+ },
81
+
82
+ // Convert a base-64 string to a byte array
83
+ base64ToBytes: function(base64) {
84
+ // Remove non-base-64 characters
85
+ base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
86
+
87
+ for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
88
+ imod4 = ++i % 4) {
89
+ if (imod4 == 0) continue;
90
+ bytes.push(((base64map.indexOf(base64.charAt(i - 1))
91
+ & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
92
+ | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
93
+ }
94
+ return bytes;
95
+ }
96
+ };
97
+
98
+ module.exports = crypt;
99
+ })();
100
+ });
101
+
102
+ var charenc = {
103
+ // UTF-8 encoding
104
+ utf8: {
105
+ // Convert a string to a byte array
106
+ stringToBytes: function(str) {
107
+ return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
108
+ },
109
+
110
+ // Convert a byte array to a string
111
+ bytesToString: function(bytes) {
112
+ return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
113
+ }
114
+ },
115
+
116
+ // Binary encoding
117
+ bin: {
118
+ // Convert a string to a byte array
119
+ stringToBytes: function(str) {
120
+ for (var bytes = [], i = 0; i < str.length; i++)
121
+ bytes.push(str.charCodeAt(i) & 0xFF);
122
+ return bytes;
123
+ },
124
+
125
+ // Convert a byte array to a string
126
+ bytesToString: function(bytes) {
127
+ for (var str = [], i = 0; i < bytes.length; i++)
128
+ str.push(String.fromCharCode(bytes[i]));
129
+ return str.join('');
130
+ }
131
+ }
132
+ };
133
+
134
+ var charenc_1 = charenc;
135
+
136
+ /*!
137
+ * Determine if an object is a Buffer
138
+ *
139
+ * @author Feross Aboukhadijeh <https://feross.org>
140
+ * @license MIT
141
+ */
142
+
143
+ // The _isBuffer check is for Safari 5-7 support, because it's missing
144
+ // Object.prototype.constructor. Remove this eventually
145
+ var isBuffer_1 = function (obj) {
146
+ return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
147
+ };
148
+
149
+ function isBuffer (obj) {
150
+ return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
151
+ }
152
+
153
+ // For Node v0.10 support. Remove this eventually.
154
+ function isSlowBuffer (obj) {
155
+ return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
156
+ }
157
+
158
+ var md5 = createCommonjsModule(function (module) {
159
+ (function(){
160
+ var crypt$1 = crypt,
161
+ utf8 = charenc_1.utf8,
162
+ isBuffer = isBuffer_1,
163
+ bin = charenc_1.bin,
164
+
165
+ // The core
166
+ md5 = function (message, options) {
167
+ // Convert to byte array
168
+ if (message.constructor == String)
169
+ if (options && options.encoding === 'binary')
170
+ message = bin.stringToBytes(message);
171
+ else
172
+ message = utf8.stringToBytes(message);
173
+ else if (isBuffer(message))
174
+ message = Array.prototype.slice.call(message, 0);
175
+ else if (!Array.isArray(message) && message.constructor !== Uint8Array)
176
+ message = message.toString();
177
+ // else, assume byte array already
178
+
179
+ var m = crypt$1.bytesToWords(message),
180
+ l = message.length * 8,
181
+ a = 1732584193,
182
+ b = -271733879,
183
+ c = -1732584194,
184
+ d = 271733878;
185
+
186
+ // Swap endian
187
+ for (var i = 0; i < m.length; i++) {
188
+ m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
189
+ ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
190
+ }
191
+
192
+ // Padding
193
+ m[l >>> 5] |= 0x80 << (l % 32);
194
+ m[(((l + 64) >>> 9) << 4) + 14] = l;
195
+
196
+ // Method shortcuts
197
+ var FF = md5._ff,
198
+ GG = md5._gg,
199
+ HH = md5._hh,
200
+ II = md5._ii;
201
+
202
+ for (var i = 0; i < m.length; i += 16) {
203
+
204
+ var aa = a,
205
+ bb = b,
206
+ cc = c,
207
+ dd = d;
208
+
209
+ a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
210
+ d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
211
+ c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
212
+ b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
213
+ a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
214
+ d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
215
+ c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
216
+ b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
217
+ a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
218
+ d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
219
+ c = FF(c, d, a, b, m[i+10], 17, -42063);
220
+ b = FF(b, c, d, a, m[i+11], 22, -1990404162);
221
+ a = FF(a, b, c, d, m[i+12], 7, 1804603682);
222
+ d = FF(d, a, b, c, m[i+13], 12, -40341101);
223
+ c = FF(c, d, a, b, m[i+14], 17, -1502002290);
224
+ b = FF(b, c, d, a, m[i+15], 22, 1236535329);
225
+
226
+ a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
227
+ d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
228
+ c = GG(c, d, a, b, m[i+11], 14, 643717713);
229
+ b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
230
+ a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
231
+ d = GG(d, a, b, c, m[i+10], 9, 38016083);
232
+ c = GG(c, d, a, b, m[i+15], 14, -660478335);
233
+ b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
234
+ a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
235
+ d = GG(d, a, b, c, m[i+14], 9, -1019803690);
236
+ c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
237
+ b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
238
+ a = GG(a, b, c, d, m[i+13], 5, -1444681467);
239
+ d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
240
+ c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
241
+ b = GG(b, c, d, a, m[i+12], 20, -1926607734);
242
+
243
+ a = HH(a, b, c, d, m[i+ 5], 4, -378558);
244
+ d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
245
+ c = HH(c, d, a, b, m[i+11], 16, 1839030562);
246
+ b = HH(b, c, d, a, m[i+14], 23, -35309556);
247
+ a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
248
+ d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
249
+ c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
250
+ b = HH(b, c, d, a, m[i+10], 23, -1094730640);
251
+ a = HH(a, b, c, d, m[i+13], 4, 681279174);
252
+ d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
253
+ c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
254
+ b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
255
+ a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
256
+ d = HH(d, a, b, c, m[i+12], 11, -421815835);
257
+ c = HH(c, d, a, b, m[i+15], 16, 530742520);
258
+ b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
259
+
260
+ a = II(a, b, c, d, m[i+ 0], 6, -198630844);
261
+ d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
262
+ c = II(c, d, a, b, m[i+14], 15, -1416354905);
263
+ b = II(b, c, d, a, m[i+ 5], 21, -57434055);
264
+ a = II(a, b, c, d, m[i+12], 6, 1700485571);
265
+ d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
266
+ c = II(c, d, a, b, m[i+10], 15, -1051523);
267
+ b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
268
+ a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
269
+ d = II(d, a, b, c, m[i+15], 10, -30611744);
270
+ c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
271
+ b = II(b, c, d, a, m[i+13], 21, 1309151649);
272
+ a = II(a, b, c, d, m[i+ 4], 6, -145523070);
273
+ d = II(d, a, b, c, m[i+11], 10, -1120210379);
274
+ c = II(c, d, a, b, m[i+ 2], 15, 718787259);
275
+ b = II(b, c, d, a, m[i+ 9], 21, -343485551);
276
+
277
+ a = (a + aa) >>> 0;
278
+ b = (b + bb) >>> 0;
279
+ c = (c + cc) >>> 0;
280
+ d = (d + dd) >>> 0;
281
+ }
282
+
283
+ return crypt$1.endian([a, b, c, d]);
284
+ };
285
+
286
+ // Auxiliary functions
287
+ md5._ff = function (a, b, c, d, x, s, t) {
288
+ var n = a + (b & c | ~b & d) + (x >>> 0) + t;
289
+ return ((n << s) | (n >>> (32 - s))) + b;
290
+ };
291
+ md5._gg = function (a, b, c, d, x, s, t) {
292
+ var n = a + (b & d | c & ~d) + (x >>> 0) + t;
293
+ return ((n << s) | (n >>> (32 - s))) + b;
294
+ };
295
+ md5._hh = function (a, b, c, d, x, s, t) {
296
+ var n = a + (b ^ c ^ d) + (x >>> 0) + t;
297
+ return ((n << s) | (n >>> (32 - s))) + b;
298
+ };
299
+ md5._ii = function (a, b, c, d, x, s, t) {
300
+ var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
301
+ return ((n << s) | (n >>> (32 - s))) + b;
302
+ };
303
+
304
+ // Package private blocksize
305
+ md5._blocksize = 16;
306
+ md5._digestsize = 16;
307
+
308
+ module.exports = function (message, options) {
309
+ if (message === undefined || message === null)
310
+ throw new Error('Illegal argument ' + message);
311
+
312
+ var digestbytes = crypt$1.wordsToBytes(md5(message, options));
313
+ return options && options.asBytes ? digestbytes :
314
+ options && options.asString ? bin.bytesToString(digestbytes) :
315
+ crypt$1.bytesToHex(digestbytes);
316
+ };
317
+
318
+ })();
319
+ });
320
+
321
+ export { md5 as m };