condo 1.0.6 → 2.0.0

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.textile +19 -32
  3. data/lib/condo.rb +124 -127
  4. data/lib/condo/configuration.rb +41 -76
  5. data/lib/condo/engine.rb +32 -39
  6. data/lib/condo/errors.rb +6 -8
  7. data/lib/condo/strata/amazon_s3.rb +246 -294
  8. data/lib/condo/strata/google_cloud_storage.rb +238 -272
  9. data/lib/condo/strata/open_stack_swift.rb +251 -0
  10. data/lib/condo/version.rb +1 -1
  11. metadata +31 -96
  12. data/app/assets/javascripts/condo.js +0 -9
  13. data/app/assets/javascripts/condo/amazon.js +0 -403
  14. data/app/assets/javascripts/condo/condo.js +0 -184
  15. data/app/assets/javascripts/condo/config.js +0 -69
  16. data/app/assets/javascripts/condo/google.js +0 -338
  17. data/app/assets/javascripts/condo/md5/hash.worker.emulator.js +0 -23
  18. data/app/assets/javascripts/condo/md5/hash.worker.js +0 -11
  19. data/app/assets/javascripts/condo/md5/hasher.js +0 -119
  20. data/app/assets/javascripts/condo/md5/spark-md5.js +0 -599
  21. data/app/assets/javascripts/condo/rackspace.js +0 -326
  22. data/app/assets/javascripts/condo/services/abstract-md5.js.erb +0 -86
  23. data/app/assets/javascripts/condo/services/base64.js +0 -184
  24. data/app/assets/javascripts/condo/services/broadcaster.js +0 -26
  25. data/app/assets/javascripts/condo/services/uploader.js +0 -302
  26. data/app/assets/javascripts/core/core.js +0 -4
  27. data/app/assets/javascripts/core/services/1-safe-apply.js +0 -17
  28. data/app/assets/javascripts/core/services/2-messaging.js +0 -171
  29. data/lib/condo/strata/rackspace_cloud_files.rb +0 -245
  30. data/test/condo_test.rb +0 -27
  31. data/test/dummy/README.rdoc +0 -261
  32. data/test/dummy/Rakefile +0 -7
  33. data/test/dummy/app/assets/javascripts/application.js +0 -15
  34. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  35. data/test/dummy/app/controllers/application_controller.rb +0 -3
  36. data/test/dummy/app/helpers/application_helper.rb +0 -2
  37. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  38. data/test/dummy/config.ru +0 -4
  39. data/test/dummy/config/application.rb +0 -59
  40. data/test/dummy/config/boot.rb +0 -10
  41. data/test/dummy/config/database.yml +0 -25
  42. data/test/dummy/config/environment.rb +0 -5
  43. data/test/dummy/config/environments/development.rb +0 -37
  44. data/test/dummy/config/environments/production.rb +0 -67
  45. data/test/dummy/config/environments/test.rb +0 -37
  46. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  47. data/test/dummy/config/initializers/inflections.rb +0 -15
  48. data/test/dummy/config/initializers/mime_types.rb +0 -5
  49. data/test/dummy/config/initializers/secret_token.rb +0 -7
  50. data/test/dummy/config/initializers/session_store.rb +0 -8
  51. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  52. data/test/dummy/config/locales/en.yml +0 -5
  53. data/test/dummy/config/routes.rb +0 -58
  54. data/test/dummy/public/404.html +0 -26
  55. data/test/dummy/public/422.html +0 -26
  56. data/test/dummy/public/500.html +0 -25
  57. data/test/dummy/public/favicon.ico +0 -0
  58. data/test/dummy/script/rails +0 -6
  59. data/test/integration/navigation_test.rb +0 -10
  60. data/test/test_helper.rb +0 -15
@@ -1,599 +0,0 @@
1
- /*jshint bitwise:false*/
2
- /*global unescape*/
3
-
4
- (function (factory) {
5
- if (typeof exports === 'object') {
6
- // Node/CommonJS
7
- module.exports = factory();
8
- } else if (typeof define === 'function' && define.amd) {
9
- // AMD
10
- define('spark-md5', factory);
11
- } else {
12
- // Browser globals (with support for web workers)
13
- var glob;
14
- try {
15
- glob = window;
16
- } catch (e) {
17
- glob = self;
18
- }
19
-
20
- glob.SparkMD5 = factory();
21
- }
22
- }(function (undefined) {
23
-
24
- 'use strict';
25
-
26
- ////////////////////////////////////////////////////////////////////////////
27
-
28
- /*
29
- * Fastest md5 implementation around (JKM md5)
30
- * Credits: Joseph Myers
31
- *
32
- * @see http://www.myersdaily.org/joseph/javascript/md5-text.html
33
- * @see http://jsperf.com/md5-shootout/7
34
- */
35
-
36
- /* this function is much faster,
37
- so if possible we use it. Some IEs
38
- are the only ones I know of that
39
- need the idiotic second function,
40
- generated by an if clause. */
41
- var add32 = function (a, b) {
42
- return (a + b) & 0xFFFFFFFF;
43
- },
44
-
45
- cmn = function (q, a, b, x, s, t) {
46
- a = add32(add32(a, q), add32(x, t));
47
- return add32((a << s) | (a >>> (32 - s)), b);
48
- },
49
-
50
- ff = function (a, b, c, d, x, s, t) {
51
- return cmn((b & c) | ((~b) & d), a, b, x, s, t);
52
- },
53
-
54
- gg = function (a, b, c, d, x, s, t) {
55
- return cmn((b & d) | (c & (~d)), a, b, x, s, t);
56
- },
57
-
58
- hh = function (a, b, c, d, x, s, t) {
59
- return cmn(b ^ c ^ d, a, b, x, s, t);
60
- },
61
-
62
- ii = function (a, b, c, d, x, s, t) {
63
- return cmn(c ^ (b | (~d)), a, b, x, s, t);
64
- },
65
-
66
- md5cycle = function (x, k) {
67
- var a = x[0],
68
- b = x[1],
69
- c = x[2],
70
- d = x[3];
71
-
72
- a = ff(a, b, c, d, k[0], 7, -680876936);
73
- d = ff(d, a, b, c, k[1], 12, -389564586);
74
- c = ff(c, d, a, b, k[2], 17, 606105819);
75
- b = ff(b, c, d, a, k[3], 22, -1044525330);
76
- a = ff(a, b, c, d, k[4], 7, -176418897);
77
- d = ff(d, a, b, c, k[5], 12, 1200080426);
78
- c = ff(c, d, a, b, k[6], 17, -1473231341);
79
- b = ff(b, c, d, a, k[7], 22, -45705983);
80
- a = ff(a, b, c, d, k[8], 7, 1770035416);
81
- d = ff(d, a, b, c, k[9], 12, -1958414417);
82
- c = ff(c, d, a, b, k[10], 17, -42063);
83
- b = ff(b, c, d, a, k[11], 22, -1990404162);
84
- a = ff(a, b, c, d, k[12], 7, 1804603682);
85
- d = ff(d, a, b, c, k[13], 12, -40341101);
86
- c = ff(c, d, a, b, k[14], 17, -1502002290);
87
- b = ff(b, c, d, a, k[15], 22, 1236535329);
88
-
89
- a = gg(a, b, c, d, k[1], 5, -165796510);
90
- d = gg(d, a, b, c, k[6], 9, -1069501632);
91
- c = gg(c, d, a, b, k[11], 14, 643717713);
92
- b = gg(b, c, d, a, k[0], 20, -373897302);
93
- a = gg(a, b, c, d, k[5], 5, -701558691);
94
- d = gg(d, a, b, c, k[10], 9, 38016083);
95
- c = gg(c, d, a, b, k[15], 14, -660478335);
96
- b = gg(b, c, d, a, k[4], 20, -405537848);
97
- a = gg(a, b, c, d, k[9], 5, 568446438);
98
- d = gg(d, a, b, c, k[14], 9, -1019803690);
99
- c = gg(c, d, a, b, k[3], 14, -187363961);
100
- b = gg(b, c, d, a, k[8], 20, 1163531501);
101
- a = gg(a, b, c, d, k[13], 5, -1444681467);
102
- d = gg(d, a, b, c, k[2], 9, -51403784);
103
- c = gg(c, d, a, b, k[7], 14, 1735328473);
104
- b = gg(b, c, d, a, k[12], 20, -1926607734);
105
-
106
- a = hh(a, b, c, d, k[5], 4, -378558);
107
- d = hh(d, a, b, c, k[8], 11, -2022574463);
108
- c = hh(c, d, a, b, k[11], 16, 1839030562);
109
- b = hh(b, c, d, a, k[14], 23, -35309556);
110
- a = hh(a, b, c, d, k[1], 4, -1530992060);
111
- d = hh(d, a, b, c, k[4], 11, 1272893353);
112
- c = hh(c, d, a, b, k[7], 16, -155497632);
113
- b = hh(b, c, d, a, k[10], 23, -1094730640);
114
- a = hh(a, b, c, d, k[13], 4, 681279174);
115
- d = hh(d, a, b, c, k[0], 11, -358537222);
116
- c = hh(c, d, a, b, k[3], 16, -722521979);
117
- b = hh(b, c, d, a, k[6], 23, 76029189);
118
- a = hh(a, b, c, d, k[9], 4, -640364487);
119
- d = hh(d, a, b, c, k[12], 11, -421815835);
120
- c = hh(c, d, a, b, k[15], 16, 530742520);
121
- b = hh(b, c, d, a, k[2], 23, -995338651);
122
-
123
- a = ii(a, b, c, d, k[0], 6, -198630844);
124
- d = ii(d, a, b, c, k[7], 10, 1126891415);
125
- c = ii(c, d, a, b, k[14], 15, -1416354905);
126
- b = ii(b, c, d, a, k[5], 21, -57434055);
127
- a = ii(a, b, c, d, k[12], 6, 1700485571);
128
- d = ii(d, a, b, c, k[3], 10, -1894986606);
129
- c = ii(c, d, a, b, k[10], 15, -1051523);
130
- b = ii(b, c, d, a, k[1], 21, -2054922799);
131
- a = ii(a, b, c, d, k[8], 6, 1873313359);
132
- d = ii(d, a, b, c, k[15], 10, -30611744);
133
- c = ii(c, d, a, b, k[6], 15, -1560198380);
134
- b = ii(b, c, d, a, k[13], 21, 1309151649);
135
- a = ii(a, b, c, d, k[4], 6, -145523070);
136
- d = ii(d, a, b, c, k[11], 10, -1120210379);
137
- c = ii(c, d, a, b, k[2], 15, 718787259);
138
- b = ii(b, c, d, a, k[9], 21, -343485551);
139
-
140
- x[0] = add32(a, x[0]);
141
- x[1] = add32(b, x[1]);
142
- x[2] = add32(c, x[2]);
143
- x[3] = add32(d, x[3]);
144
- },
145
-
146
- /* there needs to be support for Unicode here,
147
- * unless we pretend that we can redefine the MD-5
148
- * algorithm for multi-byte characters (perhaps
149
- * by adding every four 16-bit characters and
150
- * shortening the sum to 32 bits). Otherwise
151
- * I suggest performing MD-5 as if every character
152
- * was two bytes--e.g., 0040 0025 = @%--but then
153
- * how will an ordinary MD-5 sum be matched?
154
- * There is no way to standardize text to something
155
- * like UTF-8 before transformation; speed cost is
156
- * utterly prohibitive. The JavaScript standard
157
- * itself needs to look at this: it should start
158
- * providing access to strings as preformed UTF-8
159
- * 8-bit unsigned value arrays.
160
- */
161
- md5blk = function (s) {
162
- var md5blks = [],
163
- i; /* Andy King said do it this way. */
164
-
165
- for (i = 0; i < 64; i += 4) {
166
- md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
167
- }
168
- return md5blks;
169
- },
170
-
171
- md5blk_array = function (a) {
172
- var md5blks = [],
173
- i; /* Andy King said do it this way. */
174
-
175
- for (i = 0; i < 64; i += 4) {
176
- md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);
177
- }
178
- return md5blks;
179
- },
180
-
181
- md51 = function (s) {
182
- var n = s.length,
183
- state = [1732584193, -271733879, -1732584194, 271733878],
184
- i,
185
- length,
186
- tail,
187
- tmp,
188
- lo,
189
- hi;
190
-
191
- for (i = 64; i <= n; i += 64) {
192
- md5cycle(state, md5blk(s.substring(i - 64, i)));
193
- }
194
- s = s.substring(i - 64);
195
- length = s.length;
196
- tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
197
- for (i = 0; i < length; i += 1) {
198
- tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);
199
- }
200
- tail[i >> 2] |= 0x80 << ((i % 4) << 3);
201
- if (i > 55) {
202
- md5cycle(state, tail);
203
- for (i = 0; i < 16; i += 1) {
204
- tail[i] = 0;
205
- }
206
- }
207
-
208
- // Beware that the final length might not fit in 32 bits so we take care of that
209
- tmp = n * 8;
210
- tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
211
- lo = parseInt(tmp[2], 16);
212
- hi = parseInt(tmp[1], 16) || 0;
213
-
214
- tail[14] = lo;
215
- tail[15] = hi;
216
-
217
- md5cycle(state, tail);
218
- return state;
219
- },
220
-
221
- md51_array = function (a) {
222
- var n = a.length,
223
- state = [1732584193, -271733879, -1732584194, 271733878],
224
- i,
225
- length,
226
- tail,
227
- tmp,
228
- lo,
229
- hi;
230
-
231
- for (i = 64; i <= n; i += 64) {
232
- md5cycle(state, md5blk_array(a.subarray(i - 64, i)));
233
- }
234
-
235
- // Not sure if it is a bug, however IE10 will always produce a sub array of length 1
236
- // containing the last element of the parent array if the sub array specified starts
237
- // beyond the length of the parent array - weird.
238
- // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue
239
- a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);
240
-
241
- length = a.length;
242
- tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
243
- for (i = 0; i < length; i += 1) {
244
- tail[i >> 2] |= a[i] << ((i % 4) << 3);
245
- }
246
-
247
- tail[i >> 2] |= 0x80 << ((i % 4) << 3);
248
- if (i > 55) {
249
- md5cycle(state, tail);
250
- for (i = 0; i < 16; i += 1) {
251
- tail[i] = 0;
252
- }
253
- }
254
-
255
- // Beware that the final length might not fit in 32 bits so we take care of that
256
- tmp = n * 8;
257
- tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
258
- lo = parseInt(tmp[2], 16);
259
- hi = parseInt(tmp[1], 16) || 0;
260
-
261
- tail[14] = lo;
262
- tail[15] = hi;
263
-
264
- md5cycle(state, tail);
265
-
266
- return state;
267
- },
268
-
269
- hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'],
270
-
271
- rhex = function (n) {
272
- var s = '',
273
- j;
274
- for (j = 0; j < 4; j += 1) {
275
- s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];
276
- }
277
- return s;
278
- },
279
-
280
- hex = function (x) {
281
- var i;
282
- for (i = 0; i < x.length; i += 1) {
283
- x[i] = rhex(x[i]);
284
- }
285
- return x.join('');
286
- },
287
-
288
- md5 = function (s) {
289
- return hex(md51(s));
290
- },
291
-
292
-
293
-
294
- ////////////////////////////////////////////////////////////////////////////
295
-
296
- /**
297
- * SparkMD5 OOP implementation.
298
- *
299
- * Use this class to perform an incremental md5, otherwise use the
300
- * static methods instead.
301
- */
302
- SparkMD5 = function () {
303
- // call reset to init the instance
304
- this.reset();
305
- };
306
-
307
-
308
- // In some cases the fast add32 function cannot be used..
309
- if (md5('hello') !== '5d41402abc4b2a76b9719d911017c592') {
310
- add32 = function (x, y) {
311
- var lsw = (x & 0xFFFF) + (y & 0xFFFF),
312
- msw = (x >> 16) + (y >> 16) + (lsw >> 16);
313
- return (msw << 16) | (lsw & 0xFFFF);
314
- };
315
- }
316
-
317
-
318
- /**
319
- * Appends a string.
320
- * A conversion will be applied if an utf8 string is detected.
321
- *
322
- * @param {String} str The string to be appended
323
- *
324
- * @return {SparkMD5} The instance itself
325
- */
326
- SparkMD5.prototype.append = function (str) {
327
- // converts the string to utf8 bytes if necessary
328
- if (/[\u0080-\uFFFF]/.test(str)) {
329
- str = unescape(encodeURIComponent(str));
330
- }
331
-
332
- // then append as binary
333
- this.appendBinary(str);
334
-
335
- return this;
336
- };
337
-
338
- /**
339
- * Appends a binary string.
340
- *
341
- * @param {String} contents The binary string to be appended
342
- *
343
- * @return {SparkMD5} The instance itself
344
- */
345
- SparkMD5.prototype.appendBinary = function (contents) {
346
- this._buff += contents;
347
- this._length += contents.length;
348
-
349
- var length = this._buff.length,
350
- i;
351
-
352
- for (i = 64; i <= length; i += 64) {
353
- md5cycle(this._state, md5blk(this._buff.substring(i - 64, i)));
354
- }
355
-
356
- this._buff = this._buff.substr(i - 64);
357
-
358
- return this;
359
- };
360
-
361
- /**
362
- * Finishes the incremental computation, reseting the internal state and
363
- * returning the result.
364
- * Use the raw parameter to obtain the raw result instead of the hex one.
365
- *
366
- * @param {Boolean} raw True to get the raw result, false to get the hex result
367
- *
368
- * @return {String|Array} The result
369
- */
370
- SparkMD5.prototype.end = function (raw) {
371
- var buff = this._buff,
372
- length = buff.length,
373
- i,
374
- tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
375
- ret;
376
-
377
- for (i = 0; i < length; i += 1) {
378
- tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);
379
- }
380
-
381
- this._finish(tail, length);
382
- ret = !!raw ? this._state : hex(this._state);
383
-
384
- this.reset();
385
-
386
- return ret;
387
- };
388
-
389
- /**
390
- * Finish the final calculation based on the tail.
391
- *
392
- * @param {Array} tail The tail (will be modified)
393
- * @param {Number} length The length of the remaining buffer
394
- */
395
- SparkMD5.prototype._finish = function (tail, length) {
396
- var i = length,
397
- tmp,
398
- lo,
399
- hi;
400
-
401
- tail[i >> 2] |= 0x80 << ((i % 4) << 3);
402
- if (i > 55) {
403
- md5cycle(this._state, tail);
404
- for (i = 0; i < 16; i += 1) {
405
- tail[i] = 0;
406
- }
407
- }
408
-
409
- // Do the final computation based on the tail and length
410
- // Beware that the final length may not fit in 32 bits so we take care of that
411
- tmp = this._length * 8;
412
- tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
413
- lo = parseInt(tmp[2], 16);
414
- hi = parseInt(tmp[1], 16) || 0;
415
-
416
- tail[14] = lo;
417
- tail[15] = hi;
418
- md5cycle(this._state, tail);
419
- };
420
-
421
- /**
422
- * Resets the internal state of the computation.
423
- *
424
- * @return {SparkMD5} The instance itself
425
- */
426
- SparkMD5.prototype.reset = function () {
427
- this._buff = "";
428
- this._length = 0;
429
- this._state = [1732584193, -271733879, -1732584194, 271733878];
430
-
431
- return this;
432
- };
433
-
434
- /**
435
- * Releases memory used by the incremental buffer and other aditional
436
- * resources. If you plan to use the instance again, use reset instead.
437
- */
438
- SparkMD5.prototype.destroy = function () {
439
- delete this._state;
440
- delete this._buff;
441
- delete this._length;
442
- };
443
-
444
-
445
- /**
446
- * Performs the md5 hash on a string.
447
- * A conversion will be applied if utf8 string is detected.
448
- *
449
- * @param {String} str The string
450
- * @param {Boolean} raw True to get the raw result, false to get the hex result
451
- *
452
- * @return {String|Array} The result
453
- */
454
- SparkMD5.hash = function (str, raw) {
455
- // converts the string to utf8 bytes if necessary
456
- if (/[\u0080-\uFFFF]/.test(str)) {
457
- str = unescape(encodeURIComponent(str));
458
- }
459
-
460
- var hash = md51(str);
461
-
462
- return !!raw ? hash : hex(hash);
463
- };
464
-
465
- /**
466
- * Performs the md5 hash on a binary string.
467
- *
468
- * @param {String} content The binary string
469
- * @param {Boolean} raw True to get the raw result, false to get the hex result
470
- *
471
- * @return {String|Array} The result
472
- */
473
- SparkMD5.hashBinary = function (content, raw) {
474
- var hash = md51(content);
475
-
476
- return !!raw ? hash : hex(hash);
477
- };
478
-
479
- /**
480
- * SparkMD5 OOP implementation for array buffers.
481
- *
482
- * Use this class to perform an incremental md5 ONLY for array buffers.
483
- */
484
- SparkMD5.ArrayBuffer = function () {
485
- // call reset to init the instance
486
- this.reset();
487
- };
488
-
489
- ////////////////////////////////////////////////////////////////////////////
490
-
491
- /**
492
- * Appends an array buffer.
493
- *
494
- * @param {ArrayBuffer} arr The array to be appended
495
- *
496
- * @return {SparkMD5.ArrayBuffer} The instance itself
497
- */
498
- SparkMD5.ArrayBuffer.prototype.append = function (arr) {
499
- // TODO: we could avoid the concatenation here but the algorithm would be more complex
500
- // if you find yourself needing extra performance, please make a PR.
501
- var buff = this._concatArrayBuffer(this._buff, arr),
502
- length = buff.length,
503
- i;
504
-
505
- this._length += arr.byteLength;
506
-
507
- for (i = 64; i <= length; i += 64) {
508
- md5cycle(this._state, md5blk_array(buff.subarray(i - 64, i)));
509
- }
510
-
511
- // Avoids IE10 weirdness (documented above)
512
- this._buff = (i - 64) < length ? buff.subarray(i - 64) : new Uint8Array(0);
513
-
514
- return this;
515
- };
516
-
517
- /**
518
- * Finishes the incremental computation, reseting the internal state and
519
- * returning the result.
520
- * Use the raw parameter to obtain the raw result instead of the hex one.
521
- *
522
- * @param {Boolean} raw True to get the raw result, false to get the hex result
523
- *
524
- * @return {String|Array} The result
525
- */
526
- SparkMD5.ArrayBuffer.prototype.end = function (raw) {
527
- var buff = this._buff,
528
- length = buff.length,
529
- tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
530
- i,
531
- ret;
532
-
533
- for (i = 0; i < length; i += 1) {
534
- tail[i >> 2] |= buff[i] << ((i % 4) << 3);
535
- }
536
-
537
- this._finish(tail, length);
538
- ret = !!raw ? this._state : hex(this._state);
539
-
540
- this.reset();
541
-
542
- return ret;
543
- };
544
-
545
- SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;
546
-
547
- /**
548
- * Resets the internal state of the computation.
549
- *
550
- * @return {SparkMD5.ArrayBuffer} The instance itself
551
- */
552
- SparkMD5.ArrayBuffer.prototype.reset = function () {
553
- this._buff = new Uint8Array(0);
554
- this._length = 0;
555
- this._state = [1732584193, -271733879, -1732584194, 271733878];
556
-
557
- return this;
558
- };
559
-
560
- /**
561
- * Releases memory used by the incremental buffer and other aditional
562
- * resources. If you plan to use the instance again, use reset instead.
563
- */
564
- SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;
565
-
566
- /**
567
- * Concats two array buffers, returning a new one.
568
- *
569
- * @param {ArrayBuffer} first The first array buffer
570
- * @param {ArrayBuffer} second The second array buffer
571
- *
572
- * @return {ArrayBuffer} The new array buffer
573
- */
574
- SparkMD5.ArrayBuffer.prototype._concatArrayBuffer = function (first, second) {
575
- var firstLength = first.length,
576
- result = new Uint8Array(firstLength + second.byteLength);
577
-
578
- result.set(first);
579
- result.set(new Uint8Array(second), firstLength);
580
-
581
- return result;
582
- };
583
-
584
- /**
585
- * Performs the md5 hash on an array buffer.
586
- *
587
- * @param {ArrayBuffer} arr The array buffer
588
- * @param {Boolean} raw True to get the raw result, false to get the hex result
589
- *
590
- * @return {String|Array} The result
591
- */
592
- SparkMD5.ArrayBuffer.hash = function (arr, raw) {
593
- var hash = md51_array(new Uint8Array(arr));
594
-
595
- return !!raw ? hash : hex(hash);
596
- };
597
-
598
- return SparkMD5;
599
- }));