@h3ravel/hashing 0.2.0-alpha.9 → 1.29.0-alpha.11
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.
- package/dist/index.cjs +42 -1948
- package/dist/index.d.ts +4 -5
- package/dist/index.js +6 -1908
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6,16 +7,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
9
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
19
16
|
}
|
|
20
17
|
return to;
|
|
21
18
|
};
|
|
@@ -23,21 +20,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
20
|
value: mod,
|
|
24
21
|
enumerable: true
|
|
25
22
|
}) : target, mod));
|
|
26
|
-
|
|
27
23
|
//#endregion
|
|
28
|
-
let
|
|
29
|
-
let
|
|
24
|
+
let _h3ravel_contracts = require("@h3ravel/contracts");
|
|
25
|
+
let _h3ravel_support = require("@h3ravel/support");
|
|
30
26
|
let argon2 = require("argon2");
|
|
31
|
-
argon2 = __toESM(argon2);
|
|
32
|
-
let
|
|
33
|
-
let
|
|
34
|
-
|
|
27
|
+
argon2 = __toESM(argon2, 1);
|
|
28
|
+
let _h3ravel_shared = require("@h3ravel/shared");
|
|
29
|
+
let bcryptjs = require("bcryptjs");
|
|
30
|
+
bcryptjs = __toESM(bcryptjs, 1);
|
|
35
31
|
let node_path = require("node:path");
|
|
36
|
-
node_path = __toESM(node_path);
|
|
32
|
+
node_path = __toESM(node_path, 1);
|
|
37
33
|
let node_fs = require("node:fs");
|
|
38
|
-
let
|
|
39
|
-
let
|
|
40
|
-
|
|
34
|
+
let _h3ravel_foundation = require("@h3ravel/foundation");
|
|
35
|
+
let _h3ravel_support_facades = require("@h3ravel/support/facades");
|
|
41
36
|
//#region src/Utils/ParseInfo.ts
|
|
42
37
|
var ParseInfo = class {
|
|
43
38
|
static getInfo(hashed, algo = "bcrypt") {
|
|
@@ -65,10 +60,9 @@ var ParseInfo = class {
|
|
|
65
60
|
return { cost: match ? parseInt(match[1], 10) : void 0 };
|
|
66
61
|
}
|
|
67
62
|
};
|
|
68
|
-
|
|
69
63
|
//#endregion
|
|
70
64
|
//#region src/Drivers/AbstractHasher.ts
|
|
71
|
-
var AbstractHasher = class extends
|
|
65
|
+
var AbstractHasher = class extends _h3ravel_contracts.IAbstractHasher {
|
|
72
66
|
/**
|
|
73
67
|
* Get information about the given hashed value.
|
|
74
68
|
*
|
|
@@ -90,10 +84,9 @@ var AbstractHasher = class extends __h3ravel_contracts.IAbstractHasher {
|
|
|
90
84
|
};
|
|
91
85
|
}
|
|
92
86
|
};
|
|
93
|
-
|
|
94
87
|
//#endregion
|
|
95
88
|
//#region src/Drivers/Argon2idHasher.ts
|
|
96
|
-
var Argon2idHasher = class extends (0,
|
|
89
|
+
var Argon2idHasher = class extends (0, _h3ravel_shared.mix)(AbstractHasher, _h3ravel_contracts.IArgon2idHasher) {
|
|
97
90
|
memory = 65536;
|
|
98
91
|
verifyAlgorithm = true;
|
|
99
92
|
threads = 1;
|
|
@@ -117,7 +110,7 @@ var Argon2idHasher = class extends (0, __h3ravel_shared.mix)(AbstractHasher, __h
|
|
|
117
110
|
parallelism: options.threads ?? this.threads
|
|
118
111
|
});
|
|
119
112
|
} catch {
|
|
120
|
-
throw new
|
|
113
|
+
throw new _h3ravel_support.RuntimeException("Argon2id hashing not supported.");
|
|
121
114
|
}
|
|
122
115
|
}
|
|
123
116
|
/**
|
|
@@ -125,7 +118,7 @@ var Argon2idHasher = class extends (0, __h3ravel_shared.mix)(AbstractHasher, __h
|
|
|
125
118
|
*/
|
|
126
119
|
async check(value, hashedValue, _options = {}) {
|
|
127
120
|
if (!hashedValue || hashedValue.length === 0) return false;
|
|
128
|
-
if (this.verifyAlgorithm && !this.isUsingCorrectAlgorithm(hashedValue)) throw new
|
|
121
|
+
if (this.verifyAlgorithm && !this.isUsingCorrectAlgorithm(hashedValue)) throw new _h3ravel_support.RuntimeException("This password does not use the Argon2id algorithm.");
|
|
129
122
|
try {
|
|
130
123
|
return await argon2.default.verify(hashedValue, value);
|
|
131
124
|
} catch {
|
|
@@ -198,10 +191,9 @@ var Argon2idHasher = class extends (0, __h3ravel_shared.mix)(AbstractHasher, __h
|
|
|
198
191
|
return info;
|
|
199
192
|
}
|
|
200
193
|
};
|
|
201
|
-
|
|
202
194
|
//#endregion
|
|
203
195
|
//#region src/Drivers/ArgonHasher.ts
|
|
204
|
-
var ArgonHasher = class extends (0,
|
|
196
|
+
var ArgonHasher = class extends (0, _h3ravel_shared.mix)(AbstractHasher, _h3ravel_contracts.IArgonHasher) {
|
|
205
197
|
memory = 65536;
|
|
206
198
|
verifyAlgorithm = true;
|
|
207
199
|
threads = 1;
|
|
@@ -225,7 +217,7 @@ var ArgonHasher = class extends (0, __h3ravel_shared.mix)(AbstractHasher, __h3ra
|
|
|
225
217
|
parallelism: options.threads ?? this.threads
|
|
226
218
|
});
|
|
227
219
|
} catch {
|
|
228
|
-
throw new
|
|
220
|
+
throw new _h3ravel_support.RuntimeException("Argon2 hashing not supported.");
|
|
229
221
|
}
|
|
230
222
|
}
|
|
231
223
|
/**
|
|
@@ -233,7 +225,7 @@ var ArgonHasher = class extends (0, __h3ravel_shared.mix)(AbstractHasher, __h3ra
|
|
|
233
225
|
*/
|
|
234
226
|
async check(value, hashedValue, _options = {}) {
|
|
235
227
|
if (!hashedValue || hashedValue.length === 0) return false;
|
|
236
|
-
if (this.verifyAlgorithm && !this.isUsingCorrectAlgorithm(hashedValue)) throw new
|
|
228
|
+
if (this.verifyAlgorithm && !this.isUsingCorrectAlgorithm(hashedValue)) throw new _h3ravel_support.RuntimeException("This password does not use the Argon2 algorithm.");
|
|
237
229
|
try {
|
|
238
230
|
return await argon2.default.verify(hashedValue, value);
|
|
239
231
|
} catch {
|
|
@@ -306,1903 +298,9 @@ var ArgonHasher = class extends (0, __h3ravel_shared.mix)(AbstractHasher, __h3ra
|
|
|
306
298
|
return info;
|
|
307
299
|
}
|
|
308
300
|
};
|
|
309
|
-
|
|
310
|
-
//#endregion
|
|
311
|
-
//#region ../../node_modules/.pnpm/bcryptjs@3.0.2/node_modules/bcryptjs/index.js
|
|
312
|
-
/**
|
|
313
|
-
* The random implementation to use as a fallback.
|
|
314
|
-
* @type {?function(number):!Array.<number>}
|
|
315
|
-
* @inner
|
|
316
|
-
*/
|
|
317
|
-
var randomFallback = null;
|
|
318
|
-
/**
|
|
319
|
-
* Generates cryptographically secure random bytes.
|
|
320
|
-
* @function
|
|
321
|
-
* @param {number} len Bytes length
|
|
322
|
-
* @returns {!Array.<number>} Random bytes
|
|
323
|
-
* @throws {Error} If no random implementation is available
|
|
324
|
-
* @inner
|
|
325
|
-
*/
|
|
326
|
-
function randomBytes(len) {
|
|
327
|
-
try {
|
|
328
|
-
return crypto.getRandomValues(new Uint8Array(len));
|
|
329
|
-
} catch {}
|
|
330
|
-
try {
|
|
331
|
-
return crypto$1.default.randomBytes(len);
|
|
332
|
-
} catch {}
|
|
333
|
-
if (!randomFallback) throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");
|
|
334
|
-
return randomFallback(len);
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Sets the pseudo random number generator to use as a fallback if neither node's `crypto` module nor the Web Crypto
|
|
338
|
-
* API is available. Please note: It is highly important that the PRNG used is cryptographically secure and that it
|
|
339
|
-
* is seeded properly!
|
|
340
|
-
* @param {?function(number):!Array.<number>} random Function taking the number of bytes to generate as its
|
|
341
|
-
* sole argument, returning the corresponding array of cryptographically secure random byte values.
|
|
342
|
-
* @see http://nodejs.org/api/crypto.html
|
|
343
|
-
* @see http://www.w3.org/TR/WebCryptoAPI/
|
|
344
|
-
*/
|
|
345
|
-
function setRandomFallback(random) {
|
|
346
|
-
randomFallback = random;
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Synchronously generates a salt.
|
|
350
|
-
* @param {number=} rounds Number of rounds to use, defaults to 10 if omitted
|
|
351
|
-
* @param {number=} seed_length Not supported.
|
|
352
|
-
* @returns {string} Resulting salt
|
|
353
|
-
* @throws {Error} If a random fallback is required but not set
|
|
354
|
-
*/
|
|
355
|
-
function genSaltSync(rounds, seed_length) {
|
|
356
|
-
rounds = rounds || GENSALT_DEFAULT_LOG2_ROUNDS;
|
|
357
|
-
if (typeof rounds !== "number") throw Error("Illegal arguments: " + typeof rounds + ", " + typeof seed_length);
|
|
358
|
-
if (rounds < 4) rounds = 4;
|
|
359
|
-
else if (rounds > 31) rounds = 31;
|
|
360
|
-
var salt = [];
|
|
361
|
-
salt.push("$2b$");
|
|
362
|
-
if (rounds < 10) salt.push("0");
|
|
363
|
-
salt.push(rounds.toString());
|
|
364
|
-
salt.push("$");
|
|
365
|
-
salt.push(base64_encode(randomBytes(BCRYPT_SALT_LEN), BCRYPT_SALT_LEN));
|
|
366
|
-
return salt.join("");
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Asynchronously generates a salt.
|
|
370
|
-
* @param {(number|function(Error, string=))=} rounds Number of rounds to use, defaults to 10 if omitted
|
|
371
|
-
* @param {(number|function(Error, string=))=} seed_length Not supported.
|
|
372
|
-
* @param {function(Error, string=)=} callback Callback receiving the error, if any, and the resulting salt
|
|
373
|
-
* @returns {!Promise} If `callback` has been omitted
|
|
374
|
-
* @throws {Error} If `callback` is present but not a function
|
|
375
|
-
*/
|
|
376
|
-
function genSalt(rounds, seed_length, callback) {
|
|
377
|
-
if (typeof seed_length === "function") callback = seed_length, seed_length = void 0;
|
|
378
|
-
if (typeof rounds === "function") callback = rounds, rounds = void 0;
|
|
379
|
-
if (typeof rounds === "undefined") rounds = GENSALT_DEFAULT_LOG2_ROUNDS;
|
|
380
|
-
else if (typeof rounds !== "number") throw Error("illegal arguments: " + typeof rounds);
|
|
381
|
-
function _async(callback$1) {
|
|
382
|
-
nextTick(function() {
|
|
383
|
-
try {
|
|
384
|
-
callback$1(null, genSaltSync(rounds));
|
|
385
|
-
} catch (err) {
|
|
386
|
-
callback$1(err);
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
if (callback) {
|
|
391
|
-
if (typeof callback !== "function") throw Error("Illegal callback: " + typeof callback);
|
|
392
|
-
_async(callback);
|
|
393
|
-
} else return new Promise(function(resolve, reject) {
|
|
394
|
-
_async(function(err, res) {
|
|
395
|
-
if (err) {
|
|
396
|
-
reject(err);
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
resolve(res);
|
|
400
|
-
});
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Synchronously generates a hash for the given password.
|
|
405
|
-
* @param {string} password Password to hash
|
|
406
|
-
* @param {(number|string)=} salt Salt length to generate or salt to use, default to 10
|
|
407
|
-
* @returns {string} Resulting hash
|
|
408
|
-
*/
|
|
409
|
-
function hashSync(password, salt) {
|
|
410
|
-
if (typeof salt === "undefined") salt = GENSALT_DEFAULT_LOG2_ROUNDS;
|
|
411
|
-
if (typeof salt === "number") salt = genSaltSync(salt);
|
|
412
|
-
if (typeof password !== "string" || typeof salt !== "string") throw Error("Illegal arguments: " + typeof password + ", " + typeof salt);
|
|
413
|
-
return _hash(password, salt);
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* Asynchronously generates a hash for the given password.
|
|
417
|
-
* @param {string} password Password to hash
|
|
418
|
-
* @param {number|string} salt Salt length to generate or salt to use
|
|
419
|
-
* @param {function(Error, string=)=} callback Callback receiving the error, if any, and the resulting hash
|
|
420
|
-
* @param {function(number)=} progressCallback Callback successively called with the percentage of rounds completed
|
|
421
|
-
* (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
|
|
422
|
-
* @returns {!Promise} If `callback` has been omitted
|
|
423
|
-
* @throws {Error} If `callback` is present but not a function
|
|
424
|
-
*/
|
|
425
|
-
function hash(password, salt, callback, progressCallback) {
|
|
426
|
-
function _async(callback$1) {
|
|
427
|
-
if (typeof password === "string" && typeof salt === "number") genSalt(salt, function(err, salt$1) {
|
|
428
|
-
_hash(password, salt$1, callback$1, progressCallback);
|
|
429
|
-
});
|
|
430
|
-
else if (typeof password === "string" && typeof salt === "string") _hash(password, salt, callback$1, progressCallback);
|
|
431
|
-
else nextTick(callback$1.bind(this, Error("Illegal arguments: " + typeof password + ", " + typeof salt)));
|
|
432
|
-
}
|
|
433
|
-
if (callback) {
|
|
434
|
-
if (typeof callback !== "function") throw Error("Illegal callback: " + typeof callback);
|
|
435
|
-
_async(callback);
|
|
436
|
-
} else return new Promise(function(resolve, reject) {
|
|
437
|
-
_async(function(err, res) {
|
|
438
|
-
if (err) {
|
|
439
|
-
reject(err);
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
resolve(res);
|
|
443
|
-
});
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Compares two strings of the same length in constant time.
|
|
448
|
-
* @param {string} known Must be of the correct length
|
|
449
|
-
* @param {string} unknown Must be the same length as `known`
|
|
450
|
-
* @returns {boolean}
|
|
451
|
-
* @inner
|
|
452
|
-
*/
|
|
453
|
-
function safeStringCompare(known, unknown) {
|
|
454
|
-
var diff = known.length ^ unknown.length;
|
|
455
|
-
for (var i = 0; i < known.length; ++i) diff |= known.charCodeAt(i) ^ unknown.charCodeAt(i);
|
|
456
|
-
return diff === 0;
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Synchronously tests a password against a hash.
|
|
460
|
-
* @param {string} password Password to compare
|
|
461
|
-
* @param {string} hash Hash to test against
|
|
462
|
-
* @returns {boolean} true if matching, otherwise false
|
|
463
|
-
* @throws {Error} If an argument is illegal
|
|
464
|
-
*/
|
|
465
|
-
function compareSync(password, hash$1) {
|
|
466
|
-
if (typeof password !== "string" || typeof hash$1 !== "string") throw Error("Illegal arguments: " + typeof password + ", " + typeof hash$1);
|
|
467
|
-
if (hash$1.length !== 60) return false;
|
|
468
|
-
return safeStringCompare(hashSync(password, hash$1.substring(0, hash$1.length - 31)), hash$1);
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Asynchronously tests a password against a hash.
|
|
472
|
-
* @param {string} password Password to compare
|
|
473
|
-
* @param {string} hashValue Hash to test against
|
|
474
|
-
* @param {function(Error, boolean)=} callback Callback receiving the error, if any, otherwise the result
|
|
475
|
-
* @param {function(number)=} progressCallback Callback successively called with the percentage of rounds completed
|
|
476
|
-
* (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
|
|
477
|
-
* @returns {!Promise} If `callback` has been omitted
|
|
478
|
-
* @throws {Error} If `callback` is present but not a function
|
|
479
|
-
*/
|
|
480
|
-
function compare(password, hashValue, callback, progressCallback) {
|
|
481
|
-
function _async(callback$1) {
|
|
482
|
-
if (typeof password !== "string" || typeof hashValue !== "string") {
|
|
483
|
-
nextTick(callback$1.bind(this, Error("Illegal arguments: " + typeof password + ", " + typeof hashValue)));
|
|
484
|
-
return;
|
|
485
|
-
}
|
|
486
|
-
if (hashValue.length !== 60) {
|
|
487
|
-
nextTick(callback$1.bind(this, null, false));
|
|
488
|
-
return;
|
|
489
|
-
}
|
|
490
|
-
hash(password, hashValue.substring(0, 29), function(err, comp) {
|
|
491
|
-
if (err) callback$1(err);
|
|
492
|
-
else callback$1(null, safeStringCompare(comp, hashValue));
|
|
493
|
-
}, progressCallback);
|
|
494
|
-
}
|
|
495
|
-
if (callback) {
|
|
496
|
-
if (typeof callback !== "function") throw Error("Illegal callback: " + typeof callback);
|
|
497
|
-
_async(callback);
|
|
498
|
-
} else return new Promise(function(resolve, reject) {
|
|
499
|
-
_async(function(err, res) {
|
|
500
|
-
if (err) {
|
|
501
|
-
reject(err);
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
resolve(res);
|
|
505
|
-
});
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
/**
|
|
509
|
-
* Gets the number of rounds used to encrypt the specified hash.
|
|
510
|
-
* @param {string} hash Hash to extract the used number of rounds from
|
|
511
|
-
* @returns {number} Number of rounds used
|
|
512
|
-
* @throws {Error} If `hash` is not a string
|
|
513
|
-
*/
|
|
514
|
-
function getRounds(hash$1) {
|
|
515
|
-
if (typeof hash$1 !== "string") throw Error("Illegal arguments: " + typeof hash$1);
|
|
516
|
-
return parseInt(hash$1.split("$")[2], 10);
|
|
517
|
-
}
|
|
518
|
-
/**
|
|
519
|
-
* Gets the salt portion from a hash. Does not validate the hash.
|
|
520
|
-
* @param {string} hash Hash to extract the salt from
|
|
521
|
-
* @returns {string} Extracted salt part
|
|
522
|
-
* @throws {Error} If `hash` is not a string or otherwise invalid
|
|
523
|
-
*/
|
|
524
|
-
function getSalt(hash$1) {
|
|
525
|
-
if (typeof hash$1 !== "string") throw Error("Illegal arguments: " + typeof hash$1);
|
|
526
|
-
if (hash$1.length !== 60) throw Error("Illegal hash length: " + hash$1.length + " != 60");
|
|
527
|
-
return hash$1.substring(0, 29);
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Tests if a password will be truncated when hashed, that is its length is
|
|
531
|
-
* greater than 72 bytes when converted to UTF-8.
|
|
532
|
-
* @param {string} password The password to test
|
|
533
|
-
* @returns {boolean} `true` if truncated, otherwise `false`
|
|
534
|
-
*/
|
|
535
|
-
function truncates(password) {
|
|
536
|
-
if (typeof password !== "string") throw Error("Illegal arguments: " + typeof password);
|
|
537
|
-
return utf8Length(password) > 72;
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
* Continues with the callback on the next tick.
|
|
541
|
-
* @function
|
|
542
|
-
* @param {function(...[*])} callback Callback to execute
|
|
543
|
-
* @inner
|
|
544
|
-
*/
|
|
545
|
-
var nextTick = typeof process !== "undefined" && process && typeof process.nextTick === "function" ? typeof setImmediate === "function" ? setImmediate : process.nextTick : setTimeout;
|
|
546
|
-
/** Calculates the byte length of a string encoded as UTF8. */
|
|
547
|
-
function utf8Length(string) {
|
|
548
|
-
var len = 0, c = 0;
|
|
549
|
-
for (var i = 0; i < string.length; ++i) {
|
|
550
|
-
c = string.charCodeAt(i);
|
|
551
|
-
if (c < 128) len += 1;
|
|
552
|
-
else if (c < 2048) len += 2;
|
|
553
|
-
else if ((c & 64512) === 55296 && (string.charCodeAt(i + 1) & 64512) === 56320) {
|
|
554
|
-
++i;
|
|
555
|
-
len += 4;
|
|
556
|
-
} else len += 3;
|
|
557
|
-
}
|
|
558
|
-
return len;
|
|
559
|
-
}
|
|
560
|
-
/** Converts a string to an array of UTF8 bytes. */
|
|
561
|
-
function utf8Array(string) {
|
|
562
|
-
var offset = 0, c1, c2;
|
|
563
|
-
var buffer = new Array(utf8Length(string));
|
|
564
|
-
for (var i = 0, k = string.length; i < k; ++i) {
|
|
565
|
-
c1 = string.charCodeAt(i);
|
|
566
|
-
if (c1 < 128) buffer[offset++] = c1;
|
|
567
|
-
else if (c1 < 2048) {
|
|
568
|
-
buffer[offset++] = c1 >> 6 | 192;
|
|
569
|
-
buffer[offset++] = c1 & 63 | 128;
|
|
570
|
-
} else if ((c1 & 64512) === 55296 && ((c2 = string.charCodeAt(i + 1)) & 64512) === 56320) {
|
|
571
|
-
c1 = 65536 + ((c1 & 1023) << 10) + (c2 & 1023);
|
|
572
|
-
++i;
|
|
573
|
-
buffer[offset++] = c1 >> 18 | 240;
|
|
574
|
-
buffer[offset++] = c1 >> 12 & 63 | 128;
|
|
575
|
-
buffer[offset++] = c1 >> 6 & 63 | 128;
|
|
576
|
-
buffer[offset++] = c1 & 63 | 128;
|
|
577
|
-
} else {
|
|
578
|
-
buffer[offset++] = c1 >> 12 | 224;
|
|
579
|
-
buffer[offset++] = c1 >> 6 & 63 | 128;
|
|
580
|
-
buffer[offset++] = c1 & 63 | 128;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
return buffer;
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* bcrypt's own non-standard base64 dictionary.
|
|
587
|
-
* @type {!Array.<string>}
|
|
588
|
-
* @const
|
|
589
|
-
* @inner
|
|
590
|
-
**/
|
|
591
|
-
var BASE64_CODE = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split("");
|
|
592
|
-
/**
|
|
593
|
-
* @type {!Array.<number>}
|
|
594
|
-
* @const
|
|
595
|
-
* @inner
|
|
596
|
-
**/
|
|
597
|
-
var BASE64_INDEX = [
|
|
598
|
-
-1,
|
|
599
|
-
-1,
|
|
600
|
-
-1,
|
|
601
|
-
-1,
|
|
602
|
-
-1,
|
|
603
|
-
-1,
|
|
604
|
-
-1,
|
|
605
|
-
-1,
|
|
606
|
-
-1,
|
|
607
|
-
-1,
|
|
608
|
-
-1,
|
|
609
|
-
-1,
|
|
610
|
-
-1,
|
|
611
|
-
-1,
|
|
612
|
-
-1,
|
|
613
|
-
-1,
|
|
614
|
-
-1,
|
|
615
|
-
-1,
|
|
616
|
-
-1,
|
|
617
|
-
-1,
|
|
618
|
-
-1,
|
|
619
|
-
-1,
|
|
620
|
-
-1,
|
|
621
|
-
-1,
|
|
622
|
-
-1,
|
|
623
|
-
-1,
|
|
624
|
-
-1,
|
|
625
|
-
-1,
|
|
626
|
-
-1,
|
|
627
|
-
-1,
|
|
628
|
-
-1,
|
|
629
|
-
-1,
|
|
630
|
-
-1,
|
|
631
|
-
-1,
|
|
632
|
-
-1,
|
|
633
|
-
-1,
|
|
634
|
-
-1,
|
|
635
|
-
-1,
|
|
636
|
-
-1,
|
|
637
|
-
-1,
|
|
638
|
-
-1,
|
|
639
|
-
-1,
|
|
640
|
-
-1,
|
|
641
|
-
-1,
|
|
642
|
-
-1,
|
|
643
|
-
-1,
|
|
644
|
-
0,
|
|
645
|
-
1,
|
|
646
|
-
54,
|
|
647
|
-
55,
|
|
648
|
-
56,
|
|
649
|
-
57,
|
|
650
|
-
58,
|
|
651
|
-
59,
|
|
652
|
-
60,
|
|
653
|
-
61,
|
|
654
|
-
62,
|
|
655
|
-
63,
|
|
656
|
-
-1,
|
|
657
|
-
-1,
|
|
658
|
-
-1,
|
|
659
|
-
-1,
|
|
660
|
-
-1,
|
|
661
|
-
-1,
|
|
662
|
-
-1,
|
|
663
|
-
2,
|
|
664
|
-
3,
|
|
665
|
-
4,
|
|
666
|
-
5,
|
|
667
|
-
6,
|
|
668
|
-
7,
|
|
669
|
-
8,
|
|
670
|
-
9,
|
|
671
|
-
10,
|
|
672
|
-
11,
|
|
673
|
-
12,
|
|
674
|
-
13,
|
|
675
|
-
14,
|
|
676
|
-
15,
|
|
677
|
-
16,
|
|
678
|
-
17,
|
|
679
|
-
18,
|
|
680
|
-
19,
|
|
681
|
-
20,
|
|
682
|
-
21,
|
|
683
|
-
22,
|
|
684
|
-
23,
|
|
685
|
-
24,
|
|
686
|
-
25,
|
|
687
|
-
26,
|
|
688
|
-
27,
|
|
689
|
-
-1,
|
|
690
|
-
-1,
|
|
691
|
-
-1,
|
|
692
|
-
-1,
|
|
693
|
-
-1,
|
|
694
|
-
-1,
|
|
695
|
-
28,
|
|
696
|
-
29,
|
|
697
|
-
30,
|
|
698
|
-
31,
|
|
699
|
-
32,
|
|
700
|
-
33,
|
|
701
|
-
34,
|
|
702
|
-
35,
|
|
703
|
-
36,
|
|
704
|
-
37,
|
|
705
|
-
38,
|
|
706
|
-
39,
|
|
707
|
-
40,
|
|
708
|
-
41,
|
|
709
|
-
42,
|
|
710
|
-
43,
|
|
711
|
-
44,
|
|
712
|
-
45,
|
|
713
|
-
46,
|
|
714
|
-
47,
|
|
715
|
-
48,
|
|
716
|
-
49,
|
|
717
|
-
50,
|
|
718
|
-
51,
|
|
719
|
-
52,
|
|
720
|
-
53,
|
|
721
|
-
-1,
|
|
722
|
-
-1,
|
|
723
|
-
-1,
|
|
724
|
-
-1,
|
|
725
|
-
-1
|
|
726
|
-
];
|
|
727
|
-
/**
|
|
728
|
-
* Encodes a byte array to base64 with up to len bytes of input.
|
|
729
|
-
* @param {!Array.<number>} b Byte array
|
|
730
|
-
* @param {number} len Maximum input length
|
|
731
|
-
* @returns {string}
|
|
732
|
-
* @inner
|
|
733
|
-
*/
|
|
734
|
-
function base64_encode(b, len) {
|
|
735
|
-
var off = 0, rs = [], c1, c2;
|
|
736
|
-
if (len <= 0 || len > b.length) throw Error("Illegal len: " + len);
|
|
737
|
-
while (off < len) {
|
|
738
|
-
c1 = b[off++] & 255;
|
|
739
|
-
rs.push(BASE64_CODE[c1 >> 2 & 63]);
|
|
740
|
-
c1 = (c1 & 3) << 4;
|
|
741
|
-
if (off >= len) {
|
|
742
|
-
rs.push(BASE64_CODE[c1 & 63]);
|
|
743
|
-
break;
|
|
744
|
-
}
|
|
745
|
-
c2 = b[off++] & 255;
|
|
746
|
-
c1 |= c2 >> 4 & 15;
|
|
747
|
-
rs.push(BASE64_CODE[c1 & 63]);
|
|
748
|
-
c1 = (c2 & 15) << 2;
|
|
749
|
-
if (off >= len) {
|
|
750
|
-
rs.push(BASE64_CODE[c1 & 63]);
|
|
751
|
-
break;
|
|
752
|
-
}
|
|
753
|
-
c2 = b[off++] & 255;
|
|
754
|
-
c1 |= c2 >> 6 & 3;
|
|
755
|
-
rs.push(BASE64_CODE[c1 & 63]);
|
|
756
|
-
rs.push(BASE64_CODE[c2 & 63]);
|
|
757
|
-
}
|
|
758
|
-
return rs.join("");
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* Decodes a base64 encoded string to up to len bytes of output.
|
|
762
|
-
* @param {string} s String to decode
|
|
763
|
-
* @param {number} len Maximum output length
|
|
764
|
-
* @returns {!Array.<number>}
|
|
765
|
-
* @inner
|
|
766
|
-
*/
|
|
767
|
-
function base64_decode(s, len) {
|
|
768
|
-
var off = 0, slen = s.length, olen = 0, rs = [], c1, c2, c3, c4, o, code;
|
|
769
|
-
if (len <= 0) throw Error("Illegal len: " + len);
|
|
770
|
-
while (off < slen - 1 && olen < len) {
|
|
771
|
-
code = s.charCodeAt(off++);
|
|
772
|
-
c1 = code < BASE64_INDEX.length ? BASE64_INDEX[code] : -1;
|
|
773
|
-
code = s.charCodeAt(off++);
|
|
774
|
-
c2 = code < BASE64_INDEX.length ? BASE64_INDEX[code] : -1;
|
|
775
|
-
if (c1 == -1 || c2 == -1) break;
|
|
776
|
-
o = c1 << 2 >>> 0;
|
|
777
|
-
o |= (c2 & 48) >> 4;
|
|
778
|
-
rs.push(String.fromCharCode(o));
|
|
779
|
-
if (++olen >= len || off >= slen) break;
|
|
780
|
-
code = s.charCodeAt(off++);
|
|
781
|
-
c3 = code < BASE64_INDEX.length ? BASE64_INDEX[code] : -1;
|
|
782
|
-
if (c3 == -1) break;
|
|
783
|
-
o = (c2 & 15) << 4 >>> 0;
|
|
784
|
-
o |= (c3 & 60) >> 2;
|
|
785
|
-
rs.push(String.fromCharCode(o));
|
|
786
|
-
if (++olen >= len || off >= slen) break;
|
|
787
|
-
code = s.charCodeAt(off++);
|
|
788
|
-
c4 = code < BASE64_INDEX.length ? BASE64_INDEX[code] : -1;
|
|
789
|
-
o = (c3 & 3) << 6 >>> 0;
|
|
790
|
-
o |= c4;
|
|
791
|
-
rs.push(String.fromCharCode(o));
|
|
792
|
-
++olen;
|
|
793
|
-
}
|
|
794
|
-
var res = [];
|
|
795
|
-
for (off = 0; off < olen; off++) res.push(rs[off].charCodeAt(0));
|
|
796
|
-
return res;
|
|
797
|
-
}
|
|
798
|
-
/**
|
|
799
|
-
* @type {number}
|
|
800
|
-
* @const
|
|
801
|
-
* @inner
|
|
802
|
-
*/
|
|
803
|
-
var BCRYPT_SALT_LEN = 16;
|
|
804
|
-
/**
|
|
805
|
-
* @type {number}
|
|
806
|
-
* @const
|
|
807
|
-
* @inner
|
|
808
|
-
*/
|
|
809
|
-
var GENSALT_DEFAULT_LOG2_ROUNDS = 10;
|
|
810
|
-
/**
|
|
811
|
-
* @type {number}
|
|
812
|
-
* @const
|
|
813
|
-
* @inner
|
|
814
|
-
*/
|
|
815
|
-
var BLOWFISH_NUM_ROUNDS = 16;
|
|
816
|
-
/**
|
|
817
|
-
* @type {number}
|
|
818
|
-
* @const
|
|
819
|
-
* @inner
|
|
820
|
-
*/
|
|
821
|
-
var MAX_EXECUTION_TIME = 100;
|
|
822
|
-
/**
|
|
823
|
-
* @type {Array.<number>}
|
|
824
|
-
* @const
|
|
825
|
-
* @inner
|
|
826
|
-
*/
|
|
827
|
-
var P_ORIG = [
|
|
828
|
-
608135816,
|
|
829
|
-
2242054355,
|
|
830
|
-
320440878,
|
|
831
|
-
57701188,
|
|
832
|
-
2752067618,
|
|
833
|
-
698298832,
|
|
834
|
-
137296536,
|
|
835
|
-
3964562569,
|
|
836
|
-
1160258022,
|
|
837
|
-
953160567,
|
|
838
|
-
3193202383,
|
|
839
|
-
887688300,
|
|
840
|
-
3232508343,
|
|
841
|
-
3380367581,
|
|
842
|
-
1065670069,
|
|
843
|
-
3041331479,
|
|
844
|
-
2450970073,
|
|
845
|
-
2306472731
|
|
846
|
-
];
|
|
847
|
-
/**
|
|
848
|
-
* @type {Array.<number>}
|
|
849
|
-
* @const
|
|
850
|
-
* @inner
|
|
851
|
-
*/
|
|
852
|
-
var S_ORIG = [
|
|
853
|
-
3509652390,
|
|
854
|
-
2564797868,
|
|
855
|
-
805139163,
|
|
856
|
-
3491422135,
|
|
857
|
-
3101798381,
|
|
858
|
-
1780907670,
|
|
859
|
-
3128725573,
|
|
860
|
-
4046225305,
|
|
861
|
-
614570311,
|
|
862
|
-
3012652279,
|
|
863
|
-
134345442,
|
|
864
|
-
2240740374,
|
|
865
|
-
1667834072,
|
|
866
|
-
1901547113,
|
|
867
|
-
2757295779,
|
|
868
|
-
4103290238,
|
|
869
|
-
227898511,
|
|
870
|
-
1921955416,
|
|
871
|
-
1904987480,
|
|
872
|
-
2182433518,
|
|
873
|
-
2069144605,
|
|
874
|
-
3260701109,
|
|
875
|
-
2620446009,
|
|
876
|
-
720527379,
|
|
877
|
-
3318853667,
|
|
878
|
-
677414384,
|
|
879
|
-
3393288472,
|
|
880
|
-
3101374703,
|
|
881
|
-
2390351024,
|
|
882
|
-
1614419982,
|
|
883
|
-
1822297739,
|
|
884
|
-
2954791486,
|
|
885
|
-
3608508353,
|
|
886
|
-
3174124327,
|
|
887
|
-
2024746970,
|
|
888
|
-
1432378464,
|
|
889
|
-
3864339955,
|
|
890
|
-
2857741204,
|
|
891
|
-
1464375394,
|
|
892
|
-
1676153920,
|
|
893
|
-
1439316330,
|
|
894
|
-
715854006,
|
|
895
|
-
3033291828,
|
|
896
|
-
289532110,
|
|
897
|
-
2706671279,
|
|
898
|
-
2087905683,
|
|
899
|
-
3018724369,
|
|
900
|
-
1668267050,
|
|
901
|
-
732546397,
|
|
902
|
-
1947742710,
|
|
903
|
-
3462151702,
|
|
904
|
-
2609353502,
|
|
905
|
-
2950085171,
|
|
906
|
-
1814351708,
|
|
907
|
-
2050118529,
|
|
908
|
-
680887927,
|
|
909
|
-
999245976,
|
|
910
|
-
1800124847,
|
|
911
|
-
3300911131,
|
|
912
|
-
1713906067,
|
|
913
|
-
1641548236,
|
|
914
|
-
4213287313,
|
|
915
|
-
1216130144,
|
|
916
|
-
1575780402,
|
|
917
|
-
4018429277,
|
|
918
|
-
3917837745,
|
|
919
|
-
3693486850,
|
|
920
|
-
3949271944,
|
|
921
|
-
596196993,
|
|
922
|
-
3549867205,
|
|
923
|
-
258830323,
|
|
924
|
-
2213823033,
|
|
925
|
-
772490370,
|
|
926
|
-
2760122372,
|
|
927
|
-
1774776394,
|
|
928
|
-
2652871518,
|
|
929
|
-
566650946,
|
|
930
|
-
4142492826,
|
|
931
|
-
1728879713,
|
|
932
|
-
2882767088,
|
|
933
|
-
1783734482,
|
|
934
|
-
3629395816,
|
|
935
|
-
2517608232,
|
|
936
|
-
2874225571,
|
|
937
|
-
1861159788,
|
|
938
|
-
326777828,
|
|
939
|
-
3124490320,
|
|
940
|
-
2130389656,
|
|
941
|
-
2716951837,
|
|
942
|
-
967770486,
|
|
943
|
-
1724537150,
|
|
944
|
-
2185432712,
|
|
945
|
-
2364442137,
|
|
946
|
-
1164943284,
|
|
947
|
-
2105845187,
|
|
948
|
-
998989502,
|
|
949
|
-
3765401048,
|
|
950
|
-
2244026483,
|
|
951
|
-
1075463327,
|
|
952
|
-
1455516326,
|
|
953
|
-
1322494562,
|
|
954
|
-
910128902,
|
|
955
|
-
469688178,
|
|
956
|
-
1117454909,
|
|
957
|
-
936433444,
|
|
958
|
-
3490320968,
|
|
959
|
-
3675253459,
|
|
960
|
-
1240580251,
|
|
961
|
-
122909385,
|
|
962
|
-
2157517691,
|
|
963
|
-
634681816,
|
|
964
|
-
4142456567,
|
|
965
|
-
3825094682,
|
|
966
|
-
3061402683,
|
|
967
|
-
2540495037,
|
|
968
|
-
79693498,
|
|
969
|
-
3249098678,
|
|
970
|
-
1084186820,
|
|
971
|
-
1583128258,
|
|
972
|
-
426386531,
|
|
973
|
-
1761308591,
|
|
974
|
-
1047286709,
|
|
975
|
-
322548459,
|
|
976
|
-
995290223,
|
|
977
|
-
1845252383,
|
|
978
|
-
2603652396,
|
|
979
|
-
3431023940,
|
|
980
|
-
2942221577,
|
|
981
|
-
3202600964,
|
|
982
|
-
3727903485,
|
|
983
|
-
1712269319,
|
|
984
|
-
422464435,
|
|
985
|
-
3234572375,
|
|
986
|
-
1170764815,
|
|
987
|
-
3523960633,
|
|
988
|
-
3117677531,
|
|
989
|
-
1434042557,
|
|
990
|
-
442511882,
|
|
991
|
-
3600875718,
|
|
992
|
-
1076654713,
|
|
993
|
-
1738483198,
|
|
994
|
-
4213154764,
|
|
995
|
-
2393238008,
|
|
996
|
-
3677496056,
|
|
997
|
-
1014306527,
|
|
998
|
-
4251020053,
|
|
999
|
-
793779912,
|
|
1000
|
-
2902807211,
|
|
1001
|
-
842905082,
|
|
1002
|
-
4246964064,
|
|
1003
|
-
1395751752,
|
|
1004
|
-
1040244610,
|
|
1005
|
-
2656851899,
|
|
1006
|
-
3396308128,
|
|
1007
|
-
445077038,
|
|
1008
|
-
3742853595,
|
|
1009
|
-
3577915638,
|
|
1010
|
-
679411651,
|
|
1011
|
-
2892444358,
|
|
1012
|
-
2354009459,
|
|
1013
|
-
1767581616,
|
|
1014
|
-
3150600392,
|
|
1015
|
-
3791627101,
|
|
1016
|
-
3102740896,
|
|
1017
|
-
284835224,
|
|
1018
|
-
4246832056,
|
|
1019
|
-
1258075500,
|
|
1020
|
-
768725851,
|
|
1021
|
-
2589189241,
|
|
1022
|
-
3069724005,
|
|
1023
|
-
3532540348,
|
|
1024
|
-
1274779536,
|
|
1025
|
-
3789419226,
|
|
1026
|
-
2764799539,
|
|
1027
|
-
1660621633,
|
|
1028
|
-
3471099624,
|
|
1029
|
-
4011903706,
|
|
1030
|
-
913787905,
|
|
1031
|
-
3497959166,
|
|
1032
|
-
737222580,
|
|
1033
|
-
2514213453,
|
|
1034
|
-
2928710040,
|
|
1035
|
-
3937242737,
|
|
1036
|
-
1804850592,
|
|
1037
|
-
3499020752,
|
|
1038
|
-
2949064160,
|
|
1039
|
-
2386320175,
|
|
1040
|
-
2390070455,
|
|
1041
|
-
2415321851,
|
|
1042
|
-
4061277028,
|
|
1043
|
-
2290661394,
|
|
1044
|
-
2416832540,
|
|
1045
|
-
1336762016,
|
|
1046
|
-
1754252060,
|
|
1047
|
-
3520065937,
|
|
1048
|
-
3014181293,
|
|
1049
|
-
791618072,
|
|
1050
|
-
3188594551,
|
|
1051
|
-
3933548030,
|
|
1052
|
-
2332172193,
|
|
1053
|
-
3852520463,
|
|
1054
|
-
3043980520,
|
|
1055
|
-
413987798,
|
|
1056
|
-
3465142937,
|
|
1057
|
-
3030929376,
|
|
1058
|
-
4245938359,
|
|
1059
|
-
2093235073,
|
|
1060
|
-
3534596313,
|
|
1061
|
-
375366246,
|
|
1062
|
-
2157278981,
|
|
1063
|
-
2479649556,
|
|
1064
|
-
555357303,
|
|
1065
|
-
3870105701,
|
|
1066
|
-
2008414854,
|
|
1067
|
-
3344188149,
|
|
1068
|
-
4221384143,
|
|
1069
|
-
3956125452,
|
|
1070
|
-
2067696032,
|
|
1071
|
-
3594591187,
|
|
1072
|
-
2921233993,
|
|
1073
|
-
2428461,
|
|
1074
|
-
544322398,
|
|
1075
|
-
577241275,
|
|
1076
|
-
1471733935,
|
|
1077
|
-
610547355,
|
|
1078
|
-
4027169054,
|
|
1079
|
-
1432588573,
|
|
1080
|
-
1507829418,
|
|
1081
|
-
2025931657,
|
|
1082
|
-
3646575487,
|
|
1083
|
-
545086370,
|
|
1084
|
-
48609733,
|
|
1085
|
-
2200306550,
|
|
1086
|
-
1653985193,
|
|
1087
|
-
298326376,
|
|
1088
|
-
1316178497,
|
|
1089
|
-
3007786442,
|
|
1090
|
-
2064951626,
|
|
1091
|
-
458293330,
|
|
1092
|
-
2589141269,
|
|
1093
|
-
3591329599,
|
|
1094
|
-
3164325604,
|
|
1095
|
-
727753846,
|
|
1096
|
-
2179363840,
|
|
1097
|
-
146436021,
|
|
1098
|
-
1461446943,
|
|
1099
|
-
4069977195,
|
|
1100
|
-
705550613,
|
|
1101
|
-
3059967265,
|
|
1102
|
-
3887724982,
|
|
1103
|
-
4281599278,
|
|
1104
|
-
3313849956,
|
|
1105
|
-
1404054877,
|
|
1106
|
-
2845806497,
|
|
1107
|
-
146425753,
|
|
1108
|
-
1854211946,
|
|
1109
|
-
1266315497,
|
|
1110
|
-
3048417604,
|
|
1111
|
-
3681880366,
|
|
1112
|
-
3289982499,
|
|
1113
|
-
290971e4,
|
|
1114
|
-
1235738493,
|
|
1115
|
-
2632868024,
|
|
1116
|
-
2414719590,
|
|
1117
|
-
3970600049,
|
|
1118
|
-
1771706367,
|
|
1119
|
-
1449415276,
|
|
1120
|
-
3266420449,
|
|
1121
|
-
422970021,
|
|
1122
|
-
1963543593,
|
|
1123
|
-
2690192192,
|
|
1124
|
-
3826793022,
|
|
1125
|
-
1062508698,
|
|
1126
|
-
1531092325,
|
|
1127
|
-
1804592342,
|
|
1128
|
-
2583117782,
|
|
1129
|
-
2714934279,
|
|
1130
|
-
4024971509,
|
|
1131
|
-
1294809318,
|
|
1132
|
-
4028980673,
|
|
1133
|
-
1289560198,
|
|
1134
|
-
2221992742,
|
|
1135
|
-
1669523910,
|
|
1136
|
-
35572830,
|
|
1137
|
-
157838143,
|
|
1138
|
-
1052438473,
|
|
1139
|
-
1016535060,
|
|
1140
|
-
1802137761,
|
|
1141
|
-
1753167236,
|
|
1142
|
-
1386275462,
|
|
1143
|
-
3080475397,
|
|
1144
|
-
2857371447,
|
|
1145
|
-
1040679964,
|
|
1146
|
-
2145300060,
|
|
1147
|
-
2390574316,
|
|
1148
|
-
1461121720,
|
|
1149
|
-
2956646967,
|
|
1150
|
-
4031777805,
|
|
1151
|
-
4028374788,
|
|
1152
|
-
33600511,
|
|
1153
|
-
2920084762,
|
|
1154
|
-
1018524850,
|
|
1155
|
-
629373528,
|
|
1156
|
-
3691585981,
|
|
1157
|
-
3515945977,
|
|
1158
|
-
2091462646,
|
|
1159
|
-
2486323059,
|
|
1160
|
-
586499841,
|
|
1161
|
-
988145025,
|
|
1162
|
-
935516892,
|
|
1163
|
-
3367335476,
|
|
1164
|
-
2599673255,
|
|
1165
|
-
2839830854,
|
|
1166
|
-
265290510,
|
|
1167
|
-
3972581182,
|
|
1168
|
-
2759138881,
|
|
1169
|
-
3795373465,
|
|
1170
|
-
1005194799,
|
|
1171
|
-
847297441,
|
|
1172
|
-
406762289,
|
|
1173
|
-
1314163512,
|
|
1174
|
-
1332590856,
|
|
1175
|
-
1866599683,
|
|
1176
|
-
4127851711,
|
|
1177
|
-
750260880,
|
|
1178
|
-
613907577,
|
|
1179
|
-
1450815602,
|
|
1180
|
-
3165620655,
|
|
1181
|
-
3734664991,
|
|
1182
|
-
3650291728,
|
|
1183
|
-
3012275730,
|
|
1184
|
-
3704569646,
|
|
1185
|
-
1427272223,
|
|
1186
|
-
778793252,
|
|
1187
|
-
1343938022,
|
|
1188
|
-
2676280711,
|
|
1189
|
-
2052605720,
|
|
1190
|
-
1946737175,
|
|
1191
|
-
3164576444,
|
|
1192
|
-
3914038668,
|
|
1193
|
-
3967478842,
|
|
1194
|
-
3682934266,
|
|
1195
|
-
1661551462,
|
|
1196
|
-
3294938066,
|
|
1197
|
-
4011595847,
|
|
1198
|
-
840292616,
|
|
1199
|
-
3712170807,
|
|
1200
|
-
616741398,
|
|
1201
|
-
312560963,
|
|
1202
|
-
711312465,
|
|
1203
|
-
1351876610,
|
|
1204
|
-
322626781,
|
|
1205
|
-
1910503582,
|
|
1206
|
-
271666773,
|
|
1207
|
-
2175563734,
|
|
1208
|
-
1594956187,
|
|
1209
|
-
70604529,
|
|
1210
|
-
3617834859,
|
|
1211
|
-
1007753275,
|
|
1212
|
-
1495573769,
|
|
1213
|
-
4069517037,
|
|
1214
|
-
2549218298,
|
|
1215
|
-
2663038764,
|
|
1216
|
-
504708206,
|
|
1217
|
-
2263041392,
|
|
1218
|
-
3941167025,
|
|
1219
|
-
2249088522,
|
|
1220
|
-
1514023603,
|
|
1221
|
-
1998579484,
|
|
1222
|
-
1312622330,
|
|
1223
|
-
694541497,
|
|
1224
|
-
2582060303,
|
|
1225
|
-
2151582166,
|
|
1226
|
-
1382467621,
|
|
1227
|
-
776784248,
|
|
1228
|
-
2618340202,
|
|
1229
|
-
3323268794,
|
|
1230
|
-
2497899128,
|
|
1231
|
-
2784771155,
|
|
1232
|
-
503983604,
|
|
1233
|
-
4076293799,
|
|
1234
|
-
907881277,
|
|
1235
|
-
423175695,
|
|
1236
|
-
432175456,
|
|
1237
|
-
1378068232,
|
|
1238
|
-
4145222326,
|
|
1239
|
-
3954048622,
|
|
1240
|
-
3938656102,
|
|
1241
|
-
3820766613,
|
|
1242
|
-
2793130115,
|
|
1243
|
-
2977904593,
|
|
1244
|
-
26017576,
|
|
1245
|
-
3274890735,
|
|
1246
|
-
3194772133,
|
|
1247
|
-
1700274565,
|
|
1248
|
-
1756076034,
|
|
1249
|
-
4006520079,
|
|
1250
|
-
3677328699,
|
|
1251
|
-
720338349,
|
|
1252
|
-
1533947780,
|
|
1253
|
-
354530856,
|
|
1254
|
-
688349552,
|
|
1255
|
-
3973924725,
|
|
1256
|
-
1637815568,
|
|
1257
|
-
332179504,
|
|
1258
|
-
3949051286,
|
|
1259
|
-
53804574,
|
|
1260
|
-
2852348879,
|
|
1261
|
-
3044236432,
|
|
1262
|
-
1282449977,
|
|
1263
|
-
3583942155,
|
|
1264
|
-
3416972820,
|
|
1265
|
-
4006381244,
|
|
1266
|
-
1617046695,
|
|
1267
|
-
2628476075,
|
|
1268
|
-
3002303598,
|
|
1269
|
-
1686838959,
|
|
1270
|
-
431878346,
|
|
1271
|
-
2686675385,
|
|
1272
|
-
1700445008,
|
|
1273
|
-
1080580658,
|
|
1274
|
-
1009431731,
|
|
1275
|
-
832498133,
|
|
1276
|
-
3223435511,
|
|
1277
|
-
2605976345,
|
|
1278
|
-
2271191193,
|
|
1279
|
-
2516031870,
|
|
1280
|
-
1648197032,
|
|
1281
|
-
4164389018,
|
|
1282
|
-
2548247927,
|
|
1283
|
-
300782431,
|
|
1284
|
-
375919233,
|
|
1285
|
-
238389289,
|
|
1286
|
-
3353747414,
|
|
1287
|
-
2531188641,
|
|
1288
|
-
2019080857,
|
|
1289
|
-
1475708069,
|
|
1290
|
-
455242339,
|
|
1291
|
-
2609103871,
|
|
1292
|
-
448939670,
|
|
1293
|
-
3451063019,
|
|
1294
|
-
1395535956,
|
|
1295
|
-
2413381860,
|
|
1296
|
-
1841049896,
|
|
1297
|
-
1491858159,
|
|
1298
|
-
885456874,
|
|
1299
|
-
4264095073,
|
|
1300
|
-
4001119347,
|
|
1301
|
-
1565136089,
|
|
1302
|
-
3898914787,
|
|
1303
|
-
1108368660,
|
|
1304
|
-
540939232,
|
|
1305
|
-
1173283510,
|
|
1306
|
-
2745871338,
|
|
1307
|
-
3681308437,
|
|
1308
|
-
4207628240,
|
|
1309
|
-
3343053890,
|
|
1310
|
-
4016749493,
|
|
1311
|
-
1699691293,
|
|
1312
|
-
1103962373,
|
|
1313
|
-
3625875870,
|
|
1314
|
-
2256883143,
|
|
1315
|
-
3830138730,
|
|
1316
|
-
1031889488,
|
|
1317
|
-
3479347698,
|
|
1318
|
-
1535977030,
|
|
1319
|
-
4236805024,
|
|
1320
|
-
3251091107,
|
|
1321
|
-
2132092099,
|
|
1322
|
-
1774941330,
|
|
1323
|
-
1199868427,
|
|
1324
|
-
1452454533,
|
|
1325
|
-
157007616,
|
|
1326
|
-
2904115357,
|
|
1327
|
-
342012276,
|
|
1328
|
-
595725824,
|
|
1329
|
-
1480756522,
|
|
1330
|
-
206960106,
|
|
1331
|
-
497939518,
|
|
1332
|
-
591360097,
|
|
1333
|
-
863170706,
|
|
1334
|
-
2375253569,
|
|
1335
|
-
3596610801,
|
|
1336
|
-
1814182875,
|
|
1337
|
-
2094937945,
|
|
1338
|
-
3421402208,
|
|
1339
|
-
1082520231,
|
|
1340
|
-
3463918190,
|
|
1341
|
-
2785509508,
|
|
1342
|
-
435703966,
|
|
1343
|
-
3908032597,
|
|
1344
|
-
1641649973,
|
|
1345
|
-
2842273706,
|
|
1346
|
-
3305899714,
|
|
1347
|
-
1510255612,
|
|
1348
|
-
2148256476,
|
|
1349
|
-
2655287854,
|
|
1350
|
-
3276092548,
|
|
1351
|
-
4258621189,
|
|
1352
|
-
236887753,
|
|
1353
|
-
3681803219,
|
|
1354
|
-
274041037,
|
|
1355
|
-
1734335097,
|
|
1356
|
-
3815195456,
|
|
1357
|
-
3317970021,
|
|
1358
|
-
1899903192,
|
|
1359
|
-
1026095262,
|
|
1360
|
-
4050517792,
|
|
1361
|
-
356393447,
|
|
1362
|
-
2410691914,
|
|
1363
|
-
3873677099,
|
|
1364
|
-
3682840055,
|
|
1365
|
-
3913112168,
|
|
1366
|
-
2491498743,
|
|
1367
|
-
4132185628,
|
|
1368
|
-
2489919796,
|
|
1369
|
-
1091903735,
|
|
1370
|
-
1979897079,
|
|
1371
|
-
3170134830,
|
|
1372
|
-
3567386728,
|
|
1373
|
-
3557303409,
|
|
1374
|
-
857797738,
|
|
1375
|
-
1136121015,
|
|
1376
|
-
1342202287,
|
|
1377
|
-
507115054,
|
|
1378
|
-
2535736646,
|
|
1379
|
-
337727348,
|
|
1380
|
-
3213592640,
|
|
1381
|
-
1301675037,
|
|
1382
|
-
2528481711,
|
|
1383
|
-
1895095763,
|
|
1384
|
-
1721773893,
|
|
1385
|
-
3216771564,
|
|
1386
|
-
62756741,
|
|
1387
|
-
2142006736,
|
|
1388
|
-
835421444,
|
|
1389
|
-
2531993523,
|
|
1390
|
-
1442658625,
|
|
1391
|
-
3659876326,
|
|
1392
|
-
2882144922,
|
|
1393
|
-
676362277,
|
|
1394
|
-
1392781812,
|
|
1395
|
-
170690266,
|
|
1396
|
-
3921047035,
|
|
1397
|
-
1759253602,
|
|
1398
|
-
3611846912,
|
|
1399
|
-
1745797284,
|
|
1400
|
-
664899054,
|
|
1401
|
-
1329594018,
|
|
1402
|
-
3901205900,
|
|
1403
|
-
3045908486,
|
|
1404
|
-
2062866102,
|
|
1405
|
-
2865634940,
|
|
1406
|
-
3543621612,
|
|
1407
|
-
3464012697,
|
|
1408
|
-
1080764994,
|
|
1409
|
-
553557557,
|
|
1410
|
-
3656615353,
|
|
1411
|
-
3996768171,
|
|
1412
|
-
991055499,
|
|
1413
|
-
499776247,
|
|
1414
|
-
1265440854,
|
|
1415
|
-
648242737,
|
|
1416
|
-
3940784050,
|
|
1417
|
-
980351604,
|
|
1418
|
-
3713745714,
|
|
1419
|
-
1749149687,
|
|
1420
|
-
3396870395,
|
|
1421
|
-
4211799374,
|
|
1422
|
-
3640570775,
|
|
1423
|
-
1161844396,
|
|
1424
|
-
3125318951,
|
|
1425
|
-
1431517754,
|
|
1426
|
-
545492359,
|
|
1427
|
-
4268468663,
|
|
1428
|
-
3499529547,
|
|
1429
|
-
1437099964,
|
|
1430
|
-
2702547544,
|
|
1431
|
-
3433638243,
|
|
1432
|
-
2581715763,
|
|
1433
|
-
2787789398,
|
|
1434
|
-
1060185593,
|
|
1435
|
-
1593081372,
|
|
1436
|
-
2418618748,
|
|
1437
|
-
4260947970,
|
|
1438
|
-
69676912,
|
|
1439
|
-
2159744348,
|
|
1440
|
-
86519011,
|
|
1441
|
-
2512459080,
|
|
1442
|
-
3838209314,
|
|
1443
|
-
1220612927,
|
|
1444
|
-
3339683548,
|
|
1445
|
-
133810670,
|
|
1446
|
-
1090789135,
|
|
1447
|
-
1078426020,
|
|
1448
|
-
1569222167,
|
|
1449
|
-
845107691,
|
|
1450
|
-
3583754449,
|
|
1451
|
-
4072456591,
|
|
1452
|
-
1091646820,
|
|
1453
|
-
628848692,
|
|
1454
|
-
1613405280,
|
|
1455
|
-
3757631651,
|
|
1456
|
-
526609435,
|
|
1457
|
-
236106946,
|
|
1458
|
-
48312990,
|
|
1459
|
-
2942717905,
|
|
1460
|
-
3402727701,
|
|
1461
|
-
1797494240,
|
|
1462
|
-
859738849,
|
|
1463
|
-
992217954,
|
|
1464
|
-
4005476642,
|
|
1465
|
-
2243076622,
|
|
1466
|
-
3870952857,
|
|
1467
|
-
3732016268,
|
|
1468
|
-
765654824,
|
|
1469
|
-
3490871365,
|
|
1470
|
-
2511836413,
|
|
1471
|
-
1685915746,
|
|
1472
|
-
3888969200,
|
|
1473
|
-
1414112111,
|
|
1474
|
-
2273134842,
|
|
1475
|
-
3281911079,
|
|
1476
|
-
4080962846,
|
|
1477
|
-
172450625,
|
|
1478
|
-
2569994100,
|
|
1479
|
-
980381355,
|
|
1480
|
-
4109958455,
|
|
1481
|
-
2819808352,
|
|
1482
|
-
2716589560,
|
|
1483
|
-
2568741196,
|
|
1484
|
-
3681446669,
|
|
1485
|
-
3329971472,
|
|
1486
|
-
1835478071,
|
|
1487
|
-
660984891,
|
|
1488
|
-
3704678404,
|
|
1489
|
-
4045999559,
|
|
1490
|
-
3422617507,
|
|
1491
|
-
3040415634,
|
|
1492
|
-
1762651403,
|
|
1493
|
-
1719377915,
|
|
1494
|
-
3470491036,
|
|
1495
|
-
2693910283,
|
|
1496
|
-
3642056355,
|
|
1497
|
-
3138596744,
|
|
1498
|
-
1364962596,
|
|
1499
|
-
2073328063,
|
|
1500
|
-
1983633131,
|
|
1501
|
-
926494387,
|
|
1502
|
-
3423689081,
|
|
1503
|
-
2150032023,
|
|
1504
|
-
4096667949,
|
|
1505
|
-
1749200295,
|
|
1506
|
-
3328846651,
|
|
1507
|
-
309677260,
|
|
1508
|
-
2016342300,
|
|
1509
|
-
1779581495,
|
|
1510
|
-
3079819751,
|
|
1511
|
-
111262694,
|
|
1512
|
-
1274766160,
|
|
1513
|
-
443224088,
|
|
1514
|
-
298511866,
|
|
1515
|
-
1025883608,
|
|
1516
|
-
3806446537,
|
|
1517
|
-
1145181785,
|
|
1518
|
-
168956806,
|
|
1519
|
-
3641502830,
|
|
1520
|
-
3584813610,
|
|
1521
|
-
1689216846,
|
|
1522
|
-
3666258015,
|
|
1523
|
-
3200248200,
|
|
1524
|
-
1692713982,
|
|
1525
|
-
2646376535,
|
|
1526
|
-
4042768518,
|
|
1527
|
-
1618508792,
|
|
1528
|
-
1610833997,
|
|
1529
|
-
3523052358,
|
|
1530
|
-
4130873264,
|
|
1531
|
-
2001055236,
|
|
1532
|
-
3610705100,
|
|
1533
|
-
2202168115,
|
|
1534
|
-
4028541809,
|
|
1535
|
-
2961195399,
|
|
1536
|
-
1006657119,
|
|
1537
|
-
2006996926,
|
|
1538
|
-
3186142756,
|
|
1539
|
-
1430667929,
|
|
1540
|
-
3210227297,
|
|
1541
|
-
1314452623,
|
|
1542
|
-
4074634658,
|
|
1543
|
-
4101304120,
|
|
1544
|
-
2273951170,
|
|
1545
|
-
1399257539,
|
|
1546
|
-
3367210612,
|
|
1547
|
-
3027628629,
|
|
1548
|
-
1190975929,
|
|
1549
|
-
2062231137,
|
|
1550
|
-
2333990788,
|
|
1551
|
-
2221543033,
|
|
1552
|
-
2438960610,
|
|
1553
|
-
1181637006,
|
|
1554
|
-
548689776,
|
|
1555
|
-
2362791313,
|
|
1556
|
-
3372408396,
|
|
1557
|
-
3104550113,
|
|
1558
|
-
3145860560,
|
|
1559
|
-
296247880,
|
|
1560
|
-
1970579870,
|
|
1561
|
-
3078560182,
|
|
1562
|
-
3769228297,
|
|
1563
|
-
1714227617,
|
|
1564
|
-
3291629107,
|
|
1565
|
-
3898220290,
|
|
1566
|
-
166772364,
|
|
1567
|
-
1251581989,
|
|
1568
|
-
493813264,
|
|
1569
|
-
448347421,
|
|
1570
|
-
195405023,
|
|
1571
|
-
2709975567,
|
|
1572
|
-
677966185,
|
|
1573
|
-
3703036547,
|
|
1574
|
-
1463355134,
|
|
1575
|
-
2715995803,
|
|
1576
|
-
1338867538,
|
|
1577
|
-
1343315457,
|
|
1578
|
-
2802222074,
|
|
1579
|
-
2684532164,
|
|
1580
|
-
233230375,
|
|
1581
|
-
2599980071,
|
|
1582
|
-
2000651841,
|
|
1583
|
-
3277868038,
|
|
1584
|
-
1638401717,
|
|
1585
|
-
4028070440,
|
|
1586
|
-
3237316320,
|
|
1587
|
-
6314154,
|
|
1588
|
-
819756386,
|
|
1589
|
-
300326615,
|
|
1590
|
-
590932579,
|
|
1591
|
-
1405279636,
|
|
1592
|
-
3267499572,
|
|
1593
|
-
3150704214,
|
|
1594
|
-
2428286686,
|
|
1595
|
-
3959192993,
|
|
1596
|
-
3461946742,
|
|
1597
|
-
1862657033,
|
|
1598
|
-
1266418056,
|
|
1599
|
-
963775037,
|
|
1600
|
-
2089974820,
|
|
1601
|
-
2263052895,
|
|
1602
|
-
1917689273,
|
|
1603
|
-
448879540,
|
|
1604
|
-
3550394620,
|
|
1605
|
-
3981727096,
|
|
1606
|
-
150775221,
|
|
1607
|
-
3627908307,
|
|
1608
|
-
1303187396,
|
|
1609
|
-
508620638,
|
|
1610
|
-
2975983352,
|
|
1611
|
-
2726630617,
|
|
1612
|
-
1817252668,
|
|
1613
|
-
1876281319,
|
|
1614
|
-
1457606340,
|
|
1615
|
-
908771278,
|
|
1616
|
-
3720792119,
|
|
1617
|
-
3617206836,
|
|
1618
|
-
2455994898,
|
|
1619
|
-
1729034894,
|
|
1620
|
-
1080033504,
|
|
1621
|
-
976866871,
|
|
1622
|
-
3556439503,
|
|
1623
|
-
2881648439,
|
|
1624
|
-
1522871579,
|
|
1625
|
-
1555064734,
|
|
1626
|
-
1336096578,
|
|
1627
|
-
3548522304,
|
|
1628
|
-
2579274686,
|
|
1629
|
-
3574697629,
|
|
1630
|
-
3205460757,
|
|
1631
|
-
3593280638,
|
|
1632
|
-
3338716283,
|
|
1633
|
-
3079412587,
|
|
1634
|
-
564236357,
|
|
1635
|
-
2993598910,
|
|
1636
|
-
1781952180,
|
|
1637
|
-
1464380207,
|
|
1638
|
-
3163844217,
|
|
1639
|
-
3332601554,
|
|
1640
|
-
1699332808,
|
|
1641
|
-
1393555694,
|
|
1642
|
-
1183702653,
|
|
1643
|
-
3581086237,
|
|
1644
|
-
1288719814,
|
|
1645
|
-
691649499,
|
|
1646
|
-
2847557200,
|
|
1647
|
-
2895455976,
|
|
1648
|
-
3193889540,
|
|
1649
|
-
2717570544,
|
|
1650
|
-
1781354906,
|
|
1651
|
-
1676643554,
|
|
1652
|
-
2592534050,
|
|
1653
|
-
3230253752,
|
|
1654
|
-
1126444790,
|
|
1655
|
-
2770207658,
|
|
1656
|
-
2633158820,
|
|
1657
|
-
2210423226,
|
|
1658
|
-
2615765581,
|
|
1659
|
-
2414155088,
|
|
1660
|
-
3127139286,
|
|
1661
|
-
673620729,
|
|
1662
|
-
2805611233,
|
|
1663
|
-
1269405062,
|
|
1664
|
-
4015350505,
|
|
1665
|
-
3341807571,
|
|
1666
|
-
4149409754,
|
|
1667
|
-
1057255273,
|
|
1668
|
-
2012875353,
|
|
1669
|
-
2162469141,
|
|
1670
|
-
2276492801,
|
|
1671
|
-
2601117357,
|
|
1672
|
-
993977747,
|
|
1673
|
-
3918593370,
|
|
1674
|
-
2654263191,
|
|
1675
|
-
753973209,
|
|
1676
|
-
36408145,
|
|
1677
|
-
2530585658,
|
|
1678
|
-
25011837,
|
|
1679
|
-
3520020182,
|
|
1680
|
-
2088578344,
|
|
1681
|
-
530523599,
|
|
1682
|
-
2918365339,
|
|
1683
|
-
1524020338,
|
|
1684
|
-
1518925132,
|
|
1685
|
-
3760827505,
|
|
1686
|
-
3759777254,
|
|
1687
|
-
1202760957,
|
|
1688
|
-
3985898139,
|
|
1689
|
-
3906192525,
|
|
1690
|
-
674977740,
|
|
1691
|
-
4174734889,
|
|
1692
|
-
2031300136,
|
|
1693
|
-
2019492241,
|
|
1694
|
-
3983892565,
|
|
1695
|
-
4153806404,
|
|
1696
|
-
3822280332,
|
|
1697
|
-
352677332,
|
|
1698
|
-
2297720250,
|
|
1699
|
-
60907813,
|
|
1700
|
-
90501309,
|
|
1701
|
-
3286998549,
|
|
1702
|
-
1016092578,
|
|
1703
|
-
2535922412,
|
|
1704
|
-
2839152426,
|
|
1705
|
-
457141659,
|
|
1706
|
-
509813237,
|
|
1707
|
-
4120667899,
|
|
1708
|
-
652014361,
|
|
1709
|
-
1966332200,
|
|
1710
|
-
2975202805,
|
|
1711
|
-
55981186,
|
|
1712
|
-
2327461051,
|
|
1713
|
-
676427537,
|
|
1714
|
-
3255491064,
|
|
1715
|
-
2882294119,
|
|
1716
|
-
3433927263,
|
|
1717
|
-
1307055953,
|
|
1718
|
-
942726286,
|
|
1719
|
-
933058658,
|
|
1720
|
-
2468411793,
|
|
1721
|
-
3933900994,
|
|
1722
|
-
4215176142,
|
|
1723
|
-
1361170020,
|
|
1724
|
-
2001714738,
|
|
1725
|
-
2830558078,
|
|
1726
|
-
3274259782,
|
|
1727
|
-
1222529897,
|
|
1728
|
-
1679025792,
|
|
1729
|
-
2729314320,
|
|
1730
|
-
3714953764,
|
|
1731
|
-
1770335741,
|
|
1732
|
-
151462246,
|
|
1733
|
-
3013232138,
|
|
1734
|
-
1682292957,
|
|
1735
|
-
1483529935,
|
|
1736
|
-
471910574,
|
|
1737
|
-
1539241949,
|
|
1738
|
-
458788160,
|
|
1739
|
-
3436315007,
|
|
1740
|
-
1807016891,
|
|
1741
|
-
3718408830,
|
|
1742
|
-
978976581,
|
|
1743
|
-
1043663428,
|
|
1744
|
-
3165965781,
|
|
1745
|
-
1927990952,
|
|
1746
|
-
4200891579,
|
|
1747
|
-
2372276910,
|
|
1748
|
-
3208408903,
|
|
1749
|
-
3533431907,
|
|
1750
|
-
1412390302,
|
|
1751
|
-
2931980059,
|
|
1752
|
-
4132332400,
|
|
1753
|
-
1947078029,
|
|
1754
|
-
3881505623,
|
|
1755
|
-
4168226417,
|
|
1756
|
-
2941484381,
|
|
1757
|
-
1077988104,
|
|
1758
|
-
1320477388,
|
|
1759
|
-
886195818,
|
|
1760
|
-
18198404,
|
|
1761
|
-
3786409e3,
|
|
1762
|
-
2509781533,
|
|
1763
|
-
112762804,
|
|
1764
|
-
3463356488,
|
|
1765
|
-
1866414978,
|
|
1766
|
-
891333506,
|
|
1767
|
-
18488651,
|
|
1768
|
-
661792760,
|
|
1769
|
-
1628790961,
|
|
1770
|
-
3885187036,
|
|
1771
|
-
3141171499,
|
|
1772
|
-
876946877,
|
|
1773
|
-
2693282273,
|
|
1774
|
-
1372485963,
|
|
1775
|
-
791857591,
|
|
1776
|
-
2686433993,
|
|
1777
|
-
3759982718,
|
|
1778
|
-
3167212022,
|
|
1779
|
-
3472953795,
|
|
1780
|
-
2716379847,
|
|
1781
|
-
445679433,
|
|
1782
|
-
3561995674,
|
|
1783
|
-
3504004811,
|
|
1784
|
-
3574258232,
|
|
1785
|
-
54117162,
|
|
1786
|
-
3331405415,
|
|
1787
|
-
2381918588,
|
|
1788
|
-
3769707343,
|
|
1789
|
-
4154350007,
|
|
1790
|
-
1140177722,
|
|
1791
|
-
4074052095,
|
|
1792
|
-
668550556,
|
|
1793
|
-
3214352940,
|
|
1794
|
-
367459370,
|
|
1795
|
-
261225585,
|
|
1796
|
-
2610173221,
|
|
1797
|
-
4209349473,
|
|
1798
|
-
3468074219,
|
|
1799
|
-
3265815641,
|
|
1800
|
-
314222801,
|
|
1801
|
-
3066103646,
|
|
1802
|
-
3808782860,
|
|
1803
|
-
282218597,
|
|
1804
|
-
3406013506,
|
|
1805
|
-
3773591054,
|
|
1806
|
-
379116347,
|
|
1807
|
-
1285071038,
|
|
1808
|
-
846784868,
|
|
1809
|
-
2669647154,
|
|
1810
|
-
3771962079,
|
|
1811
|
-
3550491691,
|
|
1812
|
-
2305946142,
|
|
1813
|
-
453669953,
|
|
1814
|
-
1268987020,
|
|
1815
|
-
3317592352,
|
|
1816
|
-
3279303384,
|
|
1817
|
-
3744833421,
|
|
1818
|
-
2610507566,
|
|
1819
|
-
3859509063,
|
|
1820
|
-
266596637,
|
|
1821
|
-
3847019092,
|
|
1822
|
-
517658769,
|
|
1823
|
-
3462560207,
|
|
1824
|
-
3443424879,
|
|
1825
|
-
370717030,
|
|
1826
|
-
4247526661,
|
|
1827
|
-
2224018117,
|
|
1828
|
-
4143653529,
|
|
1829
|
-
4112773975,
|
|
1830
|
-
2788324899,
|
|
1831
|
-
2477274417,
|
|
1832
|
-
1456262402,
|
|
1833
|
-
2901442914,
|
|
1834
|
-
1517677493,
|
|
1835
|
-
1846949527,
|
|
1836
|
-
2295493580,
|
|
1837
|
-
3734397586,
|
|
1838
|
-
2176403920,
|
|
1839
|
-
1280348187,
|
|
1840
|
-
1908823572,
|
|
1841
|
-
3871786941,
|
|
1842
|
-
846861322,
|
|
1843
|
-
1172426758,
|
|
1844
|
-
3287448474,
|
|
1845
|
-
3383383037,
|
|
1846
|
-
1655181056,
|
|
1847
|
-
3139813346,
|
|
1848
|
-
901632758,
|
|
1849
|
-
1897031941,
|
|
1850
|
-
2986607138,
|
|
1851
|
-
3066810236,
|
|
1852
|
-
3447102507,
|
|
1853
|
-
1393639104,
|
|
1854
|
-
373351379,
|
|
1855
|
-
950779232,
|
|
1856
|
-
625454576,
|
|
1857
|
-
3124240540,
|
|
1858
|
-
4148612726,
|
|
1859
|
-
2007998917,
|
|
1860
|
-
544563296,
|
|
1861
|
-
2244738638,
|
|
1862
|
-
2330496472,
|
|
1863
|
-
2058025392,
|
|
1864
|
-
1291430526,
|
|
1865
|
-
424198748,
|
|
1866
|
-
50039436,
|
|
1867
|
-
29584100,
|
|
1868
|
-
3605783033,
|
|
1869
|
-
2429876329,
|
|
1870
|
-
2791104160,
|
|
1871
|
-
1057563949,
|
|
1872
|
-
3255363231,
|
|
1873
|
-
3075367218,
|
|
1874
|
-
3463963227,
|
|
1875
|
-
1469046755,
|
|
1876
|
-
985887462
|
|
1877
|
-
];
|
|
1878
|
-
/**
|
|
1879
|
-
* @type {Array.<number>}
|
|
1880
|
-
* @const
|
|
1881
|
-
* @inner
|
|
1882
|
-
*/
|
|
1883
|
-
var C_ORIG = [
|
|
1884
|
-
1332899944,
|
|
1885
|
-
1700884034,
|
|
1886
|
-
1701343084,
|
|
1887
|
-
1684370003,
|
|
1888
|
-
1668446532,
|
|
1889
|
-
1869963892
|
|
1890
|
-
];
|
|
1891
|
-
/**
|
|
1892
|
-
* @param {Array.<number>} lr
|
|
1893
|
-
* @param {number} off
|
|
1894
|
-
* @param {Array.<number>} P
|
|
1895
|
-
* @param {Array.<number>} S
|
|
1896
|
-
* @returns {Array.<number>}
|
|
1897
|
-
* @inner
|
|
1898
|
-
*/
|
|
1899
|
-
function _encipher(lr, off, P, S) {
|
|
1900
|
-
var n, l = lr[off], r = lr[off + 1];
|
|
1901
|
-
l ^= P[0];
|
|
1902
|
-
n = S[l >>> 24];
|
|
1903
|
-
n += S[256 | l >> 16 & 255];
|
|
1904
|
-
n ^= S[512 | l >> 8 & 255];
|
|
1905
|
-
n += S[768 | l & 255];
|
|
1906
|
-
r ^= n ^ P[1];
|
|
1907
|
-
n = S[r >>> 24];
|
|
1908
|
-
n += S[256 | r >> 16 & 255];
|
|
1909
|
-
n ^= S[512 | r >> 8 & 255];
|
|
1910
|
-
n += S[768 | r & 255];
|
|
1911
|
-
l ^= n ^ P[2];
|
|
1912
|
-
n = S[l >>> 24];
|
|
1913
|
-
n += S[256 | l >> 16 & 255];
|
|
1914
|
-
n ^= S[512 | l >> 8 & 255];
|
|
1915
|
-
n += S[768 | l & 255];
|
|
1916
|
-
r ^= n ^ P[3];
|
|
1917
|
-
n = S[r >>> 24];
|
|
1918
|
-
n += S[256 | r >> 16 & 255];
|
|
1919
|
-
n ^= S[512 | r >> 8 & 255];
|
|
1920
|
-
n += S[768 | r & 255];
|
|
1921
|
-
l ^= n ^ P[4];
|
|
1922
|
-
n = S[l >>> 24];
|
|
1923
|
-
n += S[256 | l >> 16 & 255];
|
|
1924
|
-
n ^= S[512 | l >> 8 & 255];
|
|
1925
|
-
n += S[768 | l & 255];
|
|
1926
|
-
r ^= n ^ P[5];
|
|
1927
|
-
n = S[r >>> 24];
|
|
1928
|
-
n += S[256 | r >> 16 & 255];
|
|
1929
|
-
n ^= S[512 | r >> 8 & 255];
|
|
1930
|
-
n += S[768 | r & 255];
|
|
1931
|
-
l ^= n ^ P[6];
|
|
1932
|
-
n = S[l >>> 24];
|
|
1933
|
-
n += S[256 | l >> 16 & 255];
|
|
1934
|
-
n ^= S[512 | l >> 8 & 255];
|
|
1935
|
-
n += S[768 | l & 255];
|
|
1936
|
-
r ^= n ^ P[7];
|
|
1937
|
-
n = S[r >>> 24];
|
|
1938
|
-
n += S[256 | r >> 16 & 255];
|
|
1939
|
-
n ^= S[512 | r >> 8 & 255];
|
|
1940
|
-
n += S[768 | r & 255];
|
|
1941
|
-
l ^= n ^ P[8];
|
|
1942
|
-
n = S[l >>> 24];
|
|
1943
|
-
n += S[256 | l >> 16 & 255];
|
|
1944
|
-
n ^= S[512 | l >> 8 & 255];
|
|
1945
|
-
n += S[768 | l & 255];
|
|
1946
|
-
r ^= n ^ P[9];
|
|
1947
|
-
n = S[r >>> 24];
|
|
1948
|
-
n += S[256 | r >> 16 & 255];
|
|
1949
|
-
n ^= S[512 | r >> 8 & 255];
|
|
1950
|
-
n += S[768 | r & 255];
|
|
1951
|
-
l ^= n ^ P[10];
|
|
1952
|
-
n = S[l >>> 24];
|
|
1953
|
-
n += S[256 | l >> 16 & 255];
|
|
1954
|
-
n ^= S[512 | l >> 8 & 255];
|
|
1955
|
-
n += S[768 | l & 255];
|
|
1956
|
-
r ^= n ^ P[11];
|
|
1957
|
-
n = S[r >>> 24];
|
|
1958
|
-
n += S[256 | r >> 16 & 255];
|
|
1959
|
-
n ^= S[512 | r >> 8 & 255];
|
|
1960
|
-
n += S[768 | r & 255];
|
|
1961
|
-
l ^= n ^ P[12];
|
|
1962
|
-
n = S[l >>> 24];
|
|
1963
|
-
n += S[256 | l >> 16 & 255];
|
|
1964
|
-
n ^= S[512 | l >> 8 & 255];
|
|
1965
|
-
n += S[768 | l & 255];
|
|
1966
|
-
r ^= n ^ P[13];
|
|
1967
|
-
n = S[r >>> 24];
|
|
1968
|
-
n += S[256 | r >> 16 & 255];
|
|
1969
|
-
n ^= S[512 | r >> 8 & 255];
|
|
1970
|
-
n += S[768 | r & 255];
|
|
1971
|
-
l ^= n ^ P[14];
|
|
1972
|
-
n = S[l >>> 24];
|
|
1973
|
-
n += S[256 | l >> 16 & 255];
|
|
1974
|
-
n ^= S[512 | l >> 8 & 255];
|
|
1975
|
-
n += S[768 | l & 255];
|
|
1976
|
-
r ^= n ^ P[15];
|
|
1977
|
-
n = S[r >>> 24];
|
|
1978
|
-
n += S[256 | r >> 16 & 255];
|
|
1979
|
-
n ^= S[512 | r >> 8 & 255];
|
|
1980
|
-
n += S[768 | r & 255];
|
|
1981
|
-
l ^= n ^ P[16];
|
|
1982
|
-
lr[off] = r ^ P[BLOWFISH_NUM_ROUNDS + 1];
|
|
1983
|
-
lr[off + 1] = l;
|
|
1984
|
-
return lr;
|
|
1985
|
-
}
|
|
1986
|
-
/**
|
|
1987
|
-
* @param {Array.<number>} data
|
|
1988
|
-
* @param {number} offp
|
|
1989
|
-
* @returns {{key: number, offp: number}}
|
|
1990
|
-
* @inner
|
|
1991
|
-
*/
|
|
1992
|
-
function _streamtoword(data, offp) {
|
|
1993
|
-
for (var i = 0, word = 0; i < 4; ++i) word = word << 8 | data[offp] & 255, offp = (offp + 1) % data.length;
|
|
1994
|
-
return {
|
|
1995
|
-
key: word,
|
|
1996
|
-
offp
|
|
1997
|
-
};
|
|
1998
|
-
}
|
|
1999
|
-
/**
|
|
2000
|
-
* @param {Array.<number>} key
|
|
2001
|
-
* @param {Array.<number>} P
|
|
2002
|
-
* @param {Array.<number>} S
|
|
2003
|
-
* @inner
|
|
2004
|
-
*/
|
|
2005
|
-
function _key(key, P, S) {
|
|
2006
|
-
var offset = 0, lr = [0, 0], plen = P.length, slen = S.length, sw;
|
|
2007
|
-
for (var i = 0; i < plen; i++) sw = _streamtoword(key, offset), offset = sw.offp, P[i] = P[i] ^ sw.key;
|
|
2008
|
-
for (i = 0; i < plen; i += 2) lr = _encipher(lr, 0, P, S), P[i] = lr[0], P[i + 1] = lr[1];
|
|
2009
|
-
for (i = 0; i < slen; i += 2) lr = _encipher(lr, 0, P, S), S[i] = lr[0], S[i + 1] = lr[1];
|
|
2010
|
-
}
|
|
2011
|
-
/**
|
|
2012
|
-
* Expensive key schedule Blowfish.
|
|
2013
|
-
* @param {Array.<number>} data
|
|
2014
|
-
* @param {Array.<number>} key
|
|
2015
|
-
* @param {Array.<number>} P
|
|
2016
|
-
* @param {Array.<number>} S
|
|
2017
|
-
* @inner
|
|
2018
|
-
*/
|
|
2019
|
-
function _ekskey(data, key, P, S) {
|
|
2020
|
-
var offp = 0, lr = [0, 0], plen = P.length, slen = S.length, sw;
|
|
2021
|
-
for (var i = 0; i < plen; i++) sw = _streamtoword(key, offp), offp = sw.offp, P[i] = P[i] ^ sw.key;
|
|
2022
|
-
offp = 0;
|
|
2023
|
-
for (i = 0; i < plen; i += 2) sw = _streamtoword(data, offp), offp = sw.offp, lr[0] ^= sw.key, sw = _streamtoword(data, offp), offp = sw.offp, lr[1] ^= sw.key, lr = _encipher(lr, 0, P, S), P[i] = lr[0], P[i + 1] = lr[1];
|
|
2024
|
-
for (i = 0; i < slen; i += 2) sw = _streamtoword(data, offp), offp = sw.offp, lr[0] ^= sw.key, sw = _streamtoword(data, offp), offp = sw.offp, lr[1] ^= sw.key, lr = _encipher(lr, 0, P, S), S[i] = lr[0], S[i + 1] = lr[1];
|
|
2025
|
-
}
|
|
2026
|
-
/**
|
|
2027
|
-
* Internaly crypts a string.
|
|
2028
|
-
* @param {Array.<number>} b Bytes to crypt
|
|
2029
|
-
* @param {Array.<number>} salt Salt bytes to use
|
|
2030
|
-
* @param {number} rounds Number of rounds
|
|
2031
|
-
* @param {function(Error, Array.<number>=)=} callback Callback receiving the error, if any, and the resulting bytes. If
|
|
2032
|
-
* omitted, the operation will be performed synchronously.
|
|
2033
|
-
* @param {function(number)=} progressCallback Callback called with the current progress
|
|
2034
|
-
* @returns {!Array.<number>|undefined} Resulting bytes if callback has been omitted, otherwise `undefined`
|
|
2035
|
-
* @inner
|
|
2036
|
-
*/
|
|
2037
|
-
function _crypt(b, salt, rounds, callback, progressCallback) {
|
|
2038
|
-
var cdata = C_ORIG.slice(), clen = cdata.length, err;
|
|
2039
|
-
if (rounds < 4 || rounds > 31) {
|
|
2040
|
-
err = Error("Illegal number of rounds (4-31): " + rounds);
|
|
2041
|
-
if (callback) {
|
|
2042
|
-
nextTick(callback.bind(this, err));
|
|
2043
|
-
return;
|
|
2044
|
-
} else throw err;
|
|
2045
|
-
}
|
|
2046
|
-
if (salt.length !== BCRYPT_SALT_LEN) {
|
|
2047
|
-
err = Error("Illegal salt length: " + salt.length + " != " + BCRYPT_SALT_LEN);
|
|
2048
|
-
if (callback) {
|
|
2049
|
-
nextTick(callback.bind(this, err));
|
|
2050
|
-
return;
|
|
2051
|
-
} else throw err;
|
|
2052
|
-
}
|
|
2053
|
-
rounds = 1 << rounds >>> 0;
|
|
2054
|
-
var P, S, i = 0, j;
|
|
2055
|
-
if (typeof Int32Array === "function") {
|
|
2056
|
-
P = new Int32Array(P_ORIG);
|
|
2057
|
-
S = new Int32Array(S_ORIG);
|
|
2058
|
-
} else {
|
|
2059
|
-
P = P_ORIG.slice();
|
|
2060
|
-
S = S_ORIG.slice();
|
|
2061
|
-
}
|
|
2062
|
-
_ekskey(salt, b, P, S);
|
|
2063
|
-
/**
|
|
2064
|
-
* Calcualtes the next round.
|
|
2065
|
-
* @returns {Array.<number>|undefined} Resulting array if callback has been omitted, otherwise `undefined`
|
|
2066
|
-
* @inner
|
|
2067
|
-
*/
|
|
2068
|
-
function next() {
|
|
2069
|
-
if (progressCallback) progressCallback(i / rounds);
|
|
2070
|
-
if (i < rounds) {
|
|
2071
|
-
var start = Date.now();
|
|
2072
|
-
for (; i < rounds;) {
|
|
2073
|
-
i = i + 1;
|
|
2074
|
-
_key(b, P, S);
|
|
2075
|
-
_key(salt, P, S);
|
|
2076
|
-
if (Date.now() - start > MAX_EXECUTION_TIME) break;
|
|
2077
|
-
}
|
|
2078
|
-
} else {
|
|
2079
|
-
for (i = 0; i < 64; i++) for (j = 0; j < clen >> 1; j++) _encipher(cdata, j << 1, P, S);
|
|
2080
|
-
var ret = [];
|
|
2081
|
-
for (i = 0; i < clen; i++) ret.push((cdata[i] >> 24 & 255) >>> 0), ret.push((cdata[i] >> 16 & 255) >>> 0), ret.push((cdata[i] >> 8 & 255) >>> 0), ret.push((cdata[i] & 255) >>> 0);
|
|
2082
|
-
if (callback) {
|
|
2083
|
-
callback(null, ret);
|
|
2084
|
-
return;
|
|
2085
|
-
} else return ret;
|
|
2086
|
-
}
|
|
2087
|
-
if (callback) nextTick(next);
|
|
2088
|
-
}
|
|
2089
|
-
if (typeof callback !== "undefined") next();
|
|
2090
|
-
else {
|
|
2091
|
-
var res;
|
|
2092
|
-
while (true) if (typeof (res = next()) !== "undefined") return res || [];
|
|
2093
|
-
}
|
|
2094
|
-
}
|
|
2095
|
-
/**
|
|
2096
|
-
* Internally hashes a password.
|
|
2097
|
-
* @param {string} password Password to hash
|
|
2098
|
-
* @param {?string} salt Salt to use, actually never null
|
|
2099
|
-
* @param {function(Error, string=)=} callback Callback receiving the error, if any, and the resulting hash. If omitted,
|
|
2100
|
-
* hashing is performed synchronously.
|
|
2101
|
-
* @param {function(number)=} progressCallback Callback called with the current progress
|
|
2102
|
-
* @returns {string|undefined} Resulting hash if callback has been omitted, otherwise `undefined`
|
|
2103
|
-
* @inner
|
|
2104
|
-
*/
|
|
2105
|
-
function _hash(password, salt, callback, progressCallback) {
|
|
2106
|
-
var err;
|
|
2107
|
-
if (typeof password !== "string" || typeof salt !== "string") {
|
|
2108
|
-
err = Error("Invalid string / salt: Not a string");
|
|
2109
|
-
if (callback) {
|
|
2110
|
-
nextTick(callback.bind(this, err));
|
|
2111
|
-
return;
|
|
2112
|
-
} else throw err;
|
|
2113
|
-
}
|
|
2114
|
-
var minor, offset;
|
|
2115
|
-
if (salt.charAt(0) !== "$" || salt.charAt(1) !== "2") {
|
|
2116
|
-
err = Error("Invalid salt version: " + salt.substring(0, 2));
|
|
2117
|
-
if (callback) {
|
|
2118
|
-
nextTick(callback.bind(this, err));
|
|
2119
|
-
return;
|
|
2120
|
-
} else throw err;
|
|
2121
|
-
}
|
|
2122
|
-
if (salt.charAt(2) === "$") minor = String.fromCharCode(0), offset = 3;
|
|
2123
|
-
else {
|
|
2124
|
-
minor = salt.charAt(2);
|
|
2125
|
-
if (minor !== "a" && minor !== "b" && minor !== "y" || salt.charAt(3) !== "$") {
|
|
2126
|
-
err = Error("Invalid salt revision: " + salt.substring(2, 4));
|
|
2127
|
-
if (callback) {
|
|
2128
|
-
nextTick(callback.bind(this, err));
|
|
2129
|
-
return;
|
|
2130
|
-
} else throw err;
|
|
2131
|
-
}
|
|
2132
|
-
offset = 4;
|
|
2133
|
-
}
|
|
2134
|
-
if (salt.charAt(offset + 2) > "$") {
|
|
2135
|
-
err = Error("Missing salt rounds");
|
|
2136
|
-
if (callback) {
|
|
2137
|
-
nextTick(callback.bind(this, err));
|
|
2138
|
-
return;
|
|
2139
|
-
} else throw err;
|
|
2140
|
-
}
|
|
2141
|
-
var rounds = parseInt(salt.substring(offset, offset + 1), 10) * 10 + parseInt(salt.substring(offset + 1, offset + 2), 10), real_salt = salt.substring(offset + 3, offset + 25);
|
|
2142
|
-
password += minor >= "a" ? "\0" : "";
|
|
2143
|
-
var passwordb = utf8Array(password), saltb = base64_decode(real_salt, BCRYPT_SALT_LEN);
|
|
2144
|
-
/**
|
|
2145
|
-
* Finishes hashing.
|
|
2146
|
-
* @param {Array.<number>} bytes Byte array
|
|
2147
|
-
* @returns {string}
|
|
2148
|
-
* @inner
|
|
2149
|
-
*/
|
|
2150
|
-
function finish(bytes) {
|
|
2151
|
-
var res = [];
|
|
2152
|
-
res.push("$2");
|
|
2153
|
-
if (minor >= "a") res.push(minor);
|
|
2154
|
-
res.push("$");
|
|
2155
|
-
if (rounds < 10) res.push("0");
|
|
2156
|
-
res.push(rounds.toString());
|
|
2157
|
-
res.push("$");
|
|
2158
|
-
res.push(base64_encode(saltb, saltb.length));
|
|
2159
|
-
res.push(base64_encode(bytes, C_ORIG.length * 4 - 1));
|
|
2160
|
-
return res.join("");
|
|
2161
|
-
}
|
|
2162
|
-
if (typeof callback == "undefined") return finish(_crypt(passwordb, saltb, rounds));
|
|
2163
|
-
else _crypt(passwordb, saltb, rounds, function(err$1, bytes) {
|
|
2164
|
-
if (err$1) callback(err$1, null);
|
|
2165
|
-
else callback(null, finish(bytes));
|
|
2166
|
-
}, progressCallback);
|
|
2167
|
-
}
|
|
2168
|
-
/**
|
|
2169
|
-
* Encodes a byte array to base64 with up to len bytes of input, using the custom bcrypt alphabet.
|
|
2170
|
-
* @function
|
|
2171
|
-
* @param {!Array.<number>} bytes Byte array
|
|
2172
|
-
* @param {number} length Maximum input length
|
|
2173
|
-
* @returns {string}
|
|
2174
|
-
*/
|
|
2175
|
-
function encodeBase64(bytes, length) {
|
|
2176
|
-
return base64_encode(bytes, length);
|
|
2177
|
-
}
|
|
2178
|
-
/**
|
|
2179
|
-
* Decodes a base64 encoded string to up to len bytes of output, using the custom bcrypt alphabet.
|
|
2180
|
-
* @function
|
|
2181
|
-
* @param {string} string String to decode
|
|
2182
|
-
* @param {number} length Maximum output length
|
|
2183
|
-
* @returns {!Array.<number>}
|
|
2184
|
-
*/
|
|
2185
|
-
function decodeBase64(string, length) {
|
|
2186
|
-
return base64_decode(string, length);
|
|
2187
|
-
}
|
|
2188
|
-
var bcryptjs_default = {
|
|
2189
|
-
setRandomFallback,
|
|
2190
|
-
genSaltSync,
|
|
2191
|
-
genSalt,
|
|
2192
|
-
hashSync,
|
|
2193
|
-
hash,
|
|
2194
|
-
compareSync,
|
|
2195
|
-
compare,
|
|
2196
|
-
getRounds,
|
|
2197
|
-
getSalt,
|
|
2198
|
-
truncates,
|
|
2199
|
-
encodeBase64,
|
|
2200
|
-
decodeBase64
|
|
2201
|
-
};
|
|
2202
|
-
|
|
2203
301
|
//#endregion
|
|
2204
302
|
//#region src/Drivers/BcryptHasher.ts
|
|
2205
|
-
var BcryptHasher = class extends (0,
|
|
303
|
+
var BcryptHasher = class extends (0, _h3ravel_shared.mix)(AbstractHasher, _h3ravel_contracts.IBcryptHasher) {
|
|
2206
304
|
rounds = 12;
|
|
2207
305
|
verifyAlgorithm = true;
|
|
2208
306
|
limit = null;
|
|
@@ -2221,12 +319,12 @@ var BcryptHasher = class extends (0, __h3ravel_shared.mix)(AbstractHasher, __h3r
|
|
|
2221
319
|
* @return {String}
|
|
2222
320
|
*/
|
|
2223
321
|
async make(value, options = {}) {
|
|
2224
|
-
if (this.limit && value.length > this.limit) throw new
|
|
322
|
+
if (this.limit && value.length > this.limit) throw new _h3ravel_support.InvalidArgumentException(`Value is too long to hash. Value must be less than ${this.limit} bytes`);
|
|
2225
323
|
try {
|
|
2226
|
-
const salt = await
|
|
2227
|
-
return await
|
|
324
|
+
const salt = await bcryptjs.default.genSalt(this.cost(options));
|
|
325
|
+
return await bcryptjs.default.hash(value, salt);
|
|
2228
326
|
} catch {
|
|
2229
|
-
throw new
|
|
327
|
+
throw new _h3ravel_support.RuntimeException("Bcrypt hashing not supported.");
|
|
2230
328
|
}
|
|
2231
329
|
}
|
|
2232
330
|
/**
|
|
@@ -2239,8 +337,8 @@ var BcryptHasher = class extends (0, __h3ravel_shared.mix)(AbstractHasher, __h3r
|
|
|
2239
337
|
*/
|
|
2240
338
|
async check(value, hashedValue, _options = {}) {
|
|
2241
339
|
if (!hashedValue || hashedValue.length === 0) return false;
|
|
2242
|
-
if (this.verifyAlgorithm && !this.isUsingCorrectAlgorithm(hashedValue)) throw new
|
|
2243
|
-
return
|
|
340
|
+
if (this.verifyAlgorithm && !this.isUsingCorrectAlgorithm(hashedValue)) throw new _h3ravel_support.RuntimeException("This password does not use the Bcrypt algorithm.");
|
|
341
|
+
return bcryptjs.default.compare(value, hashedValue);
|
|
2244
342
|
}
|
|
2245
343
|
/**
|
|
2246
344
|
* Get information about the given hashed value.
|
|
@@ -2305,10 +403,10 @@ var BcryptHasher = class extends (0, __h3ravel_shared.mix)(AbstractHasher, __h3r
|
|
|
2305
403
|
return options.rounds ?? this.rounds;
|
|
2306
404
|
}
|
|
2307
405
|
};
|
|
2308
|
-
|
|
2309
406
|
//#endregion
|
|
2310
407
|
//#region src/Utils/Manager.ts
|
|
2311
|
-
var Manager = class extends
|
|
408
|
+
var Manager = class extends _h3ravel_contracts.IBaseHashManager {
|
|
409
|
+
config;
|
|
2312
410
|
constructor(config = {}) {
|
|
2313
411
|
super();
|
|
2314
412
|
this.config = config;
|
|
@@ -2322,9 +420,9 @@ var Manager = class extends __h3ravel_contracts.IBaseHashManager {
|
|
|
2322
420
|
return this.config.driver ?? process.env.HASH_DRIVER ?? "bcrypt";
|
|
2323
421
|
}
|
|
2324
422
|
createDriver(driver) {
|
|
2325
|
-
const method = "create" +
|
|
423
|
+
const method = "create" + _h3ravel_support.Str.studly(driver) + "Driver";
|
|
2326
424
|
if (typeof this[method] !== "undefined") return this[method]();
|
|
2327
|
-
throw new
|
|
425
|
+
throw new _h3ravel_support.InvalidArgumentException(`Driver [${driver}] not supported.`);
|
|
2328
426
|
}
|
|
2329
427
|
/**
|
|
2330
428
|
* Determine if a given string is already hashed.
|
|
@@ -2350,14 +448,13 @@ var Manager = class extends __h3ravel_contracts.IBaseHashManager {
|
|
|
2350
448
|
if ((0, node_fs.existsSync)(tsPath)) if (process.env.NODE_ENV !== "production") {
|
|
2351
449
|
this.config = (await import(tsPath)).default ?? {};
|
|
2352
450
|
return this;
|
|
2353
|
-
} else throw new
|
|
451
|
+
} else throw new _h3ravel_foundation.ConfigException("hashing.config.ts found in production without build step");
|
|
2354
452
|
return this;
|
|
2355
453
|
}
|
|
2356
454
|
};
|
|
2357
|
-
|
|
2358
455
|
//#endregion
|
|
2359
456
|
//#region src/HashManager.ts
|
|
2360
|
-
var HashManager = class extends (0,
|
|
457
|
+
var HashManager = class extends (0, _h3ravel_shared.mix)(Manager, _h3ravel_contracts.IHashManager) {
|
|
2361
458
|
drivers = {};
|
|
2362
459
|
/**
|
|
2363
460
|
* Create an instance of the Bcrypt hash Driver.
|
|
@@ -2457,14 +554,13 @@ var HashManager = class extends (0, __h3ravel_shared.mix)(Manager, __h3ravel_con
|
|
|
2457
554
|
*/
|
|
2458
555
|
driver(driver) {
|
|
2459
556
|
driver = driver ?? this.getDefaultDriver();
|
|
2460
|
-
if (!driver) throw new
|
|
557
|
+
if (!driver) throw new _h3ravel_support.InvalidArgumentException(`Unable to resolve NULL driver for ${this.constructor.name}.'`);
|
|
2461
558
|
return this.drivers[driver] ??= this.createDriver(driver);
|
|
2462
559
|
}
|
|
2463
560
|
};
|
|
2464
561
|
const defineConfig = (config) => {
|
|
2465
562
|
return config;
|
|
2466
563
|
};
|
|
2467
|
-
|
|
2468
564
|
//#endregion
|
|
2469
565
|
//#region src/Helpers.ts
|
|
2470
566
|
var Hash = class Hash {
|
|
@@ -2539,17 +635,16 @@ var Hash = class Hash {
|
|
|
2539
635
|
* @throws {RuntimeException}
|
|
2540
636
|
*/
|
|
2541
637
|
static driver() {
|
|
2542
|
-
if (typeof Hash === "undefined") throw new
|
|
2543
|
-
return
|
|
638
|
+
if (typeof Hash === "undefined") throw new _h3ravel_support.RuntimeException("The Hash helper is only available on H3ravel, use the HashManager class instead.");
|
|
639
|
+
return _h3ravel_support_facades.Hash;
|
|
2544
640
|
}
|
|
2545
641
|
};
|
|
2546
|
-
|
|
2547
642
|
//#endregion
|
|
2548
643
|
//#region src/Providers/HashingServiceProvider.ts
|
|
2549
644
|
/**
|
|
2550
645
|
* Register HashManager.
|
|
2551
646
|
*/
|
|
2552
|
-
var HashingServiceProvider = class extends
|
|
647
|
+
var HashingServiceProvider = class extends _h3ravel_support.ServiceProvider {
|
|
2553
648
|
static priority = 991;
|
|
2554
649
|
register() {
|
|
2555
650
|
const manager = new HashManager(this.app.make("config").get("hashing"));
|
|
@@ -2561,7 +656,6 @@ var HashingServiceProvider = class extends __h3ravel_support.ServiceProvider {
|
|
|
2561
656
|
});
|
|
2562
657
|
}
|
|
2563
658
|
};
|
|
2564
|
-
|
|
2565
659
|
//#endregion
|
|
2566
660
|
exports.AbstractHasher = AbstractHasher;
|
|
2567
661
|
exports.Argon2idHasher = Argon2idHasher;
|
|
@@ -2572,4 +666,4 @@ exports.HashManager = HashManager;
|
|
|
2572
666
|
exports.HashingServiceProvider = HashingServiceProvider;
|
|
2573
667
|
exports.Manager = Manager;
|
|
2574
668
|
exports.ParseInfo = ParseInfo;
|
|
2575
|
-
exports.defineConfig = defineConfig;
|
|
669
|
+
exports.defineConfig = defineConfig;
|