@xyo-network/hash 2.99.6 → 2.100.1
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/browser/worker/jsHash-bundle.js +115 -230
- package/package.json +3 -3
|
@@ -450,8 +450,7 @@
|
|
|
450
450
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
451
451
|
}
|
|
452
452
|
var validLen = b64.indexOf("=");
|
|
453
|
-
if (validLen === -1)
|
|
454
|
-
validLen = len2;
|
|
453
|
+
if (validLen === -1) validLen = len2;
|
|
455
454
|
var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
|
|
456
455
|
return [validLen, placeHoldersLen];
|
|
457
456
|
}
|
|
@@ -644,16 +643,14 @@
|
|
|
644
643
|
Object.defineProperty(Buffer2.prototype, "parent", {
|
|
645
644
|
enumerable: true,
|
|
646
645
|
get: function() {
|
|
647
|
-
if (!Buffer2.isBuffer(this))
|
|
648
|
-
return void 0;
|
|
646
|
+
if (!Buffer2.isBuffer(this)) return void 0;
|
|
649
647
|
return this.buffer;
|
|
650
648
|
}
|
|
651
649
|
});
|
|
652
650
|
Object.defineProperty(Buffer2.prototype, "offset", {
|
|
653
651
|
enumerable: true,
|
|
654
652
|
get: function() {
|
|
655
|
-
if (!Buffer2.isBuffer(this))
|
|
656
|
-
return void 0;
|
|
653
|
+
if (!Buffer2.isBuffer(this)) return void 0;
|
|
657
654
|
return this.byteOffset;
|
|
658
655
|
}
|
|
659
656
|
});
|
|
@@ -705,8 +702,7 @@
|
|
|
705
702
|
return Buffer2.from(valueOf, encodingOrOffset, length);
|
|
706
703
|
}
|
|
707
704
|
const b = fromObject(value);
|
|
708
|
-
if (b)
|
|
709
|
-
return b;
|
|
705
|
+
if (b) return b;
|
|
710
706
|
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
|
|
711
707
|
return Buffer2.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
|
|
712
708
|
}
|
|
@@ -833,17 +829,14 @@
|
|
|
833
829
|
return b != null && b._isBuffer === true && b !== Buffer2.prototype;
|
|
834
830
|
};
|
|
835
831
|
Buffer2.compare = function compare(a, b) {
|
|
836
|
-
if (isInstance(a, Uint8Array))
|
|
837
|
-
|
|
838
|
-
if (isInstance(b, Uint8Array))
|
|
839
|
-
b = Buffer2.from(b, b.offset, b.byteLength);
|
|
832
|
+
if (isInstance(a, Uint8Array)) a = Buffer2.from(a, a.offset, a.byteLength);
|
|
833
|
+
if (isInstance(b, Uint8Array)) b = Buffer2.from(b, b.offset, b.byteLength);
|
|
840
834
|
if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) {
|
|
841
835
|
throw new TypeError(
|
|
842
836
|
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
843
837
|
);
|
|
844
838
|
}
|
|
845
|
-
if (a === b)
|
|
846
|
-
return 0;
|
|
839
|
+
if (a === b) return 0;
|
|
847
840
|
let x = a.length;
|
|
848
841
|
let y = b.length;
|
|
849
842
|
for (let i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
@@ -853,10 +846,8 @@
|
|
|
853
846
|
break;
|
|
854
847
|
}
|
|
855
848
|
}
|
|
856
|
-
if (x < y)
|
|
857
|
-
|
|
858
|
-
if (y < x)
|
|
859
|
-
return 1;
|
|
849
|
+
if (x < y) return -1;
|
|
850
|
+
if (y < x) return 1;
|
|
860
851
|
return 0;
|
|
861
852
|
};
|
|
862
853
|
Buffer2.isEncoding = function isEncoding(encoding) {
|
|
@@ -897,8 +888,7 @@
|
|
|
897
888
|
let buf = list[i];
|
|
898
889
|
if (isInstance(buf, Uint8Array)) {
|
|
899
890
|
if (pos + buf.length > buffer.length) {
|
|
900
|
-
if (!Buffer2.isBuffer(buf))
|
|
901
|
-
buf = Buffer2.from(buf);
|
|
891
|
+
if (!Buffer2.isBuffer(buf)) buf = Buffer2.from(buf);
|
|
902
892
|
buf.copy(buffer, pos);
|
|
903
893
|
} else {
|
|
904
894
|
Uint8Array.prototype.set.call(
|
|
@@ -930,8 +920,7 @@
|
|
|
930
920
|
}
|
|
931
921
|
const len = string.length;
|
|
932
922
|
const mustMatch = arguments.length > 2 && arguments[2] === true;
|
|
933
|
-
if (!mustMatch && len === 0)
|
|
934
|
-
return 0;
|
|
923
|
+
if (!mustMatch && len === 0) return 0;
|
|
935
924
|
let loweredCase = false;
|
|
936
925
|
for (; ; ) {
|
|
937
926
|
switch (encoding) {
|
|
@@ -980,8 +969,7 @@
|
|
|
980
969
|
if (end <= start) {
|
|
981
970
|
return "";
|
|
982
971
|
}
|
|
983
|
-
if (!encoding)
|
|
984
|
-
encoding = "utf8";
|
|
972
|
+
if (!encoding) encoding = "utf8";
|
|
985
973
|
while (true) {
|
|
986
974
|
switch (encoding) {
|
|
987
975
|
case "hex":
|
|
@@ -1002,8 +990,7 @@
|
|
|
1002
990
|
case "utf-16le":
|
|
1003
991
|
return utf16leSlice(this, start, end);
|
|
1004
992
|
default:
|
|
1005
|
-
if (loweredCase)
|
|
1006
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
993
|
+
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
|
|
1007
994
|
encoding = (encoding + "").toLowerCase();
|
|
1008
995
|
loweredCase = true;
|
|
1009
996
|
}
|
|
@@ -1051,26 +1038,21 @@
|
|
|
1051
1038
|
};
|
|
1052
1039
|
Buffer2.prototype.toString = function toString() {
|
|
1053
1040
|
const length = this.length;
|
|
1054
|
-
if (length === 0)
|
|
1055
|
-
|
|
1056
|
-
if (arguments.length === 0)
|
|
1057
|
-
return utf8Slice(this, 0, length);
|
|
1041
|
+
if (length === 0) return "";
|
|
1042
|
+
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
1058
1043
|
return slowToString.apply(this, arguments);
|
|
1059
1044
|
};
|
|
1060
1045
|
Buffer2.prototype.toLocaleString = Buffer2.prototype.toString;
|
|
1061
1046
|
Buffer2.prototype.equals = function equals(b) {
|
|
1062
|
-
if (!Buffer2.isBuffer(b))
|
|
1063
|
-
|
|
1064
|
-
if (this === b)
|
|
1065
|
-
return true;
|
|
1047
|
+
if (!Buffer2.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
|
|
1048
|
+
if (this === b) return true;
|
|
1066
1049
|
return Buffer2.compare(this, b) === 0;
|
|
1067
1050
|
};
|
|
1068
1051
|
Buffer2.prototype.inspect = function inspect() {
|
|
1069
1052
|
let str = "";
|
|
1070
1053
|
const max = exports.INSPECT_MAX_BYTES;
|
|
1071
1054
|
str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
|
|
1072
|
-
if (this.length > max)
|
|
1073
|
-
str += " ... ";
|
|
1055
|
+
if (this.length > max) str += " ... ";
|
|
1074
1056
|
return "<Buffer " + str + ">";
|
|
1075
1057
|
};
|
|
1076
1058
|
if (customInspectSymbol) {
|
|
@@ -1113,8 +1095,7 @@
|
|
|
1113
1095
|
end >>>= 0;
|
|
1114
1096
|
thisStart >>>= 0;
|
|
1115
1097
|
thisEnd >>>= 0;
|
|
1116
|
-
if (this === target)
|
|
1117
|
-
return 0;
|
|
1098
|
+
if (this === target) return 0;
|
|
1118
1099
|
let x = thisEnd - thisStart;
|
|
1119
1100
|
let y = end - start;
|
|
1120
1101
|
const len = Math.min(x, y);
|
|
@@ -1127,15 +1108,12 @@
|
|
|
1127
1108
|
break;
|
|
1128
1109
|
}
|
|
1129
1110
|
}
|
|
1130
|
-
if (x < y)
|
|
1131
|
-
|
|
1132
|
-
if (y < x)
|
|
1133
|
-
return 1;
|
|
1111
|
+
if (x < y) return -1;
|
|
1112
|
+
if (y < x) return 1;
|
|
1134
1113
|
return 0;
|
|
1135
1114
|
};
|
|
1136
1115
|
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
|
|
1137
|
-
if (buffer.length === 0)
|
|
1138
|
-
return -1;
|
|
1116
|
+
if (buffer.length === 0) return -1;
|
|
1139
1117
|
if (typeof byteOffset === "string") {
|
|
1140
1118
|
encoding = byteOffset;
|
|
1141
1119
|
byteOffset = 0;
|
|
@@ -1148,18 +1126,13 @@
|
|
|
1148
1126
|
if (numberIsNaN(byteOffset)) {
|
|
1149
1127
|
byteOffset = dir ? 0 : buffer.length - 1;
|
|
1150
1128
|
}
|
|
1151
|
-
if (byteOffset < 0)
|
|
1152
|
-
byteOffset = buffer.length + byteOffset;
|
|
1129
|
+
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
1153
1130
|
if (byteOffset >= buffer.length) {
|
|
1154
|
-
if (dir)
|
|
1155
|
-
|
|
1156
|
-
else
|
|
1157
|
-
byteOffset = buffer.length - 1;
|
|
1131
|
+
if (dir) return -1;
|
|
1132
|
+
else byteOffset = buffer.length - 1;
|
|
1158
1133
|
} else if (byteOffset < 0) {
|
|
1159
|
-
if (dir)
|
|
1160
|
-
|
|
1161
|
-
else
|
|
1162
|
-
return -1;
|
|
1134
|
+
if (dir) byteOffset = 0;
|
|
1135
|
+
else return -1;
|
|
1163
1136
|
}
|
|
1164
1137
|
if (typeof val === "string") {
|
|
1165
1138
|
val = Buffer2.from(val, encoding);
|
|
@@ -1210,19 +1183,15 @@
|
|
|
1210
1183
|
let foundIndex = -1;
|
|
1211
1184
|
for (i = byteOffset; i < arrLength; i++) {
|
|
1212
1185
|
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
1213
|
-
if (foundIndex === -1)
|
|
1214
|
-
|
|
1215
|
-
if (i - foundIndex + 1 === valLength)
|
|
1216
|
-
return foundIndex * indexSize;
|
|
1186
|
+
if (foundIndex === -1) foundIndex = i;
|
|
1187
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
|
1217
1188
|
} else {
|
|
1218
|
-
if (foundIndex !== -1)
|
|
1219
|
-
i -= i - foundIndex;
|
|
1189
|
+
if (foundIndex !== -1) i -= i - foundIndex;
|
|
1220
1190
|
foundIndex = -1;
|
|
1221
1191
|
}
|
|
1222
1192
|
}
|
|
1223
1193
|
} else {
|
|
1224
|
-
if (byteOffset + valLength > arrLength)
|
|
1225
|
-
byteOffset = arrLength - valLength;
|
|
1194
|
+
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
1226
1195
|
for (i = byteOffset; i >= 0; i--) {
|
|
1227
1196
|
let found = true;
|
|
1228
1197
|
for (let j = 0; j < valLength; j++) {
|
|
@@ -1231,8 +1200,7 @@
|
|
|
1231
1200
|
break;
|
|
1232
1201
|
}
|
|
1233
1202
|
}
|
|
1234
|
-
if (found)
|
|
1235
|
-
return i;
|
|
1203
|
+
if (found) return i;
|
|
1236
1204
|
}
|
|
1237
1205
|
}
|
|
1238
1206
|
return -1;
|
|
@@ -1264,8 +1232,7 @@
|
|
|
1264
1232
|
let i;
|
|
1265
1233
|
for (i = 0; i < length; ++i) {
|
|
1266
1234
|
const parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
1267
|
-
if (numberIsNaN(parsed))
|
|
1268
|
-
return i;
|
|
1235
|
+
if (numberIsNaN(parsed)) return i;
|
|
1269
1236
|
buf[offset + i] = parsed;
|
|
1270
1237
|
}
|
|
1271
1238
|
return i;
|
|
@@ -1295,8 +1262,7 @@
|
|
|
1295
1262
|
offset = offset >>> 0;
|
|
1296
1263
|
if (isFinite(length)) {
|
|
1297
1264
|
length = length >>> 0;
|
|
1298
|
-
if (encoding === void 0)
|
|
1299
|
-
encoding = "utf8";
|
|
1265
|
+
if (encoding === void 0) encoding = "utf8";
|
|
1300
1266
|
} else {
|
|
1301
1267
|
encoding = length;
|
|
1302
1268
|
length = void 0;
|
|
@@ -1307,13 +1273,11 @@
|
|
|
1307
1273
|
);
|
|
1308
1274
|
}
|
|
1309
1275
|
const remaining = this.length - offset;
|
|
1310
|
-
if (length === void 0 || length > remaining)
|
|
1311
|
-
length = remaining;
|
|
1276
|
+
if (length === void 0 || length > remaining) length = remaining;
|
|
1312
1277
|
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
|
|
1313
1278
|
throw new RangeError("Attempt to write outside buffer bounds");
|
|
1314
1279
|
}
|
|
1315
|
-
if (!encoding)
|
|
1316
|
-
encoding = "utf8";
|
|
1280
|
+
if (!encoding) encoding = "utf8";
|
|
1317
1281
|
let loweredCase = false;
|
|
1318
1282
|
for (; ; ) {
|
|
1319
1283
|
switch (encoding) {
|
|
@@ -1334,8 +1298,7 @@
|
|
|
1334
1298
|
case "utf-16le":
|
|
1335
1299
|
return ucs2Write(this, string, offset, length);
|
|
1336
1300
|
default:
|
|
1337
|
-
if (loweredCase)
|
|
1338
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
1301
|
+
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
|
|
1339
1302
|
encoding = ("" + encoding).toLowerCase();
|
|
1340
1303
|
loweredCase = true;
|
|
1341
1304
|
}
|
|
@@ -1448,10 +1411,8 @@
|
|
|
1448
1411
|
}
|
|
1449
1412
|
function hexSlice(buf, start, end) {
|
|
1450
1413
|
const len = buf.length;
|
|
1451
|
-
if (!start || start < 0)
|
|
1452
|
-
|
|
1453
|
-
if (!end || end < 0 || end > len)
|
|
1454
|
-
end = len;
|
|
1414
|
+
if (!start || start < 0) start = 0;
|
|
1415
|
+
if (!end || end < 0 || end > len) end = len;
|
|
1455
1416
|
let out = "";
|
|
1456
1417
|
for (let i = start; i < end; ++i) {
|
|
1457
1418
|
out += hexSliceLookupTable[buf[i]];
|
|
@@ -1472,35 +1433,29 @@
|
|
|
1472
1433
|
end = end === void 0 ? len : ~~end;
|
|
1473
1434
|
if (start < 0) {
|
|
1474
1435
|
start += len;
|
|
1475
|
-
if (start < 0)
|
|
1476
|
-
start = 0;
|
|
1436
|
+
if (start < 0) start = 0;
|
|
1477
1437
|
} else if (start > len) {
|
|
1478
1438
|
start = len;
|
|
1479
1439
|
}
|
|
1480
1440
|
if (end < 0) {
|
|
1481
1441
|
end += len;
|
|
1482
|
-
if (end < 0)
|
|
1483
|
-
end = 0;
|
|
1442
|
+
if (end < 0) end = 0;
|
|
1484
1443
|
} else if (end > len) {
|
|
1485
1444
|
end = len;
|
|
1486
1445
|
}
|
|
1487
|
-
if (end < start)
|
|
1488
|
-
end = start;
|
|
1446
|
+
if (end < start) end = start;
|
|
1489
1447
|
const newBuf = this.subarray(start, end);
|
|
1490
1448
|
Object.setPrototypeOf(newBuf, Buffer2.prototype);
|
|
1491
1449
|
return newBuf;
|
|
1492
1450
|
};
|
|
1493
1451
|
function checkOffset(offset, ext, length) {
|
|
1494
|
-
if (offset % 1 !== 0 || offset < 0)
|
|
1495
|
-
|
|
1496
|
-
if (offset + ext > length)
|
|
1497
|
-
throw new RangeError("Trying to access beyond buffer length");
|
|
1452
|
+
if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
|
|
1453
|
+
if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
|
|
1498
1454
|
}
|
|
1499
1455
|
Buffer2.prototype.readUintLE = Buffer2.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {
|
|
1500
1456
|
offset = offset >>> 0;
|
|
1501
1457
|
byteLength2 = byteLength2 >>> 0;
|
|
1502
|
-
if (!noAssert)
|
|
1503
|
-
checkOffset(offset, byteLength2, this.length);
|
|
1458
|
+
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1504
1459
|
let val = this[offset];
|
|
1505
1460
|
let mul = 1;
|
|
1506
1461
|
let i = 0;
|
|
@@ -1524,32 +1479,27 @@
|
|
|
1524
1479
|
};
|
|
1525
1480
|
Buffer2.prototype.readUint8 = Buffer2.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
1526
1481
|
offset = offset >>> 0;
|
|
1527
|
-
if (!noAssert)
|
|
1528
|
-
checkOffset(offset, 1, this.length);
|
|
1482
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1529
1483
|
return this[offset];
|
|
1530
1484
|
};
|
|
1531
1485
|
Buffer2.prototype.readUint16LE = Buffer2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
1532
1486
|
offset = offset >>> 0;
|
|
1533
|
-
if (!noAssert)
|
|
1534
|
-
checkOffset(offset, 2, this.length);
|
|
1487
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1535
1488
|
return this[offset] | this[offset + 1] << 8;
|
|
1536
1489
|
};
|
|
1537
1490
|
Buffer2.prototype.readUint16BE = Buffer2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
1538
1491
|
offset = offset >>> 0;
|
|
1539
|
-
if (!noAssert)
|
|
1540
|
-
checkOffset(offset, 2, this.length);
|
|
1492
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1541
1493
|
return this[offset] << 8 | this[offset + 1];
|
|
1542
1494
|
};
|
|
1543
1495
|
Buffer2.prototype.readUint32LE = Buffer2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
1544
1496
|
offset = offset >>> 0;
|
|
1545
|
-
if (!noAssert)
|
|
1546
|
-
checkOffset(offset, 4, this.length);
|
|
1497
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1547
1498
|
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
|
|
1548
1499
|
};
|
|
1549
1500
|
Buffer2.prototype.readUint32BE = Buffer2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
1550
1501
|
offset = offset >>> 0;
|
|
1551
|
-
if (!noAssert)
|
|
1552
|
-
checkOffset(offset, 4, this.length);
|
|
1502
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1553
1503
|
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
1554
1504
|
};
|
|
1555
1505
|
Buffer2.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
|
|
@@ -1579,8 +1529,7 @@
|
|
|
1579
1529
|
Buffer2.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {
|
|
1580
1530
|
offset = offset >>> 0;
|
|
1581
1531
|
byteLength2 = byteLength2 >>> 0;
|
|
1582
|
-
if (!noAssert)
|
|
1583
|
-
checkOffset(offset, byteLength2, this.length);
|
|
1532
|
+
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1584
1533
|
let val = this[offset];
|
|
1585
1534
|
let mul = 1;
|
|
1586
1535
|
let i = 0;
|
|
@@ -1588,15 +1537,13 @@
|
|
|
1588
1537
|
val += this[offset + i] * mul;
|
|
1589
1538
|
}
|
|
1590
1539
|
mul *= 128;
|
|
1591
|
-
if (val >= mul)
|
|
1592
|
-
val -= Math.pow(2, 8 * byteLength2);
|
|
1540
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
|
|
1593
1541
|
return val;
|
|
1594
1542
|
};
|
|
1595
1543
|
Buffer2.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {
|
|
1596
1544
|
offset = offset >>> 0;
|
|
1597
1545
|
byteLength2 = byteLength2 >>> 0;
|
|
1598
|
-
if (!noAssert)
|
|
1599
|
-
checkOffset(offset, byteLength2, this.length);
|
|
1546
|
+
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1600
1547
|
let i = byteLength2;
|
|
1601
1548
|
let mul = 1;
|
|
1602
1549
|
let val = this[offset + --i];
|
|
@@ -1604,42 +1551,35 @@
|
|
|
1604
1551
|
val += this[offset + --i] * mul;
|
|
1605
1552
|
}
|
|
1606
1553
|
mul *= 128;
|
|
1607
|
-
if (val >= mul)
|
|
1608
|
-
val -= Math.pow(2, 8 * byteLength2);
|
|
1554
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
|
|
1609
1555
|
return val;
|
|
1610
1556
|
};
|
|
1611
1557
|
Buffer2.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
1612
1558
|
offset = offset >>> 0;
|
|
1613
|
-
if (!noAssert)
|
|
1614
|
-
|
|
1615
|
-
if (!(this[offset] & 128))
|
|
1616
|
-
return this[offset];
|
|
1559
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1560
|
+
if (!(this[offset] & 128)) return this[offset];
|
|
1617
1561
|
return (255 - this[offset] + 1) * -1;
|
|
1618
1562
|
};
|
|
1619
1563
|
Buffer2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
1620
1564
|
offset = offset >>> 0;
|
|
1621
|
-
if (!noAssert)
|
|
1622
|
-
checkOffset(offset, 2, this.length);
|
|
1565
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1623
1566
|
const val = this[offset] | this[offset + 1] << 8;
|
|
1624
1567
|
return val & 32768 ? val | 4294901760 : val;
|
|
1625
1568
|
};
|
|
1626
1569
|
Buffer2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
1627
1570
|
offset = offset >>> 0;
|
|
1628
|
-
if (!noAssert)
|
|
1629
|
-
checkOffset(offset, 2, this.length);
|
|
1571
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1630
1572
|
const val = this[offset + 1] | this[offset] << 8;
|
|
1631
1573
|
return val & 32768 ? val | 4294901760 : val;
|
|
1632
1574
|
};
|
|
1633
1575
|
Buffer2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
1634
1576
|
offset = offset >>> 0;
|
|
1635
|
-
if (!noAssert)
|
|
1636
|
-
checkOffset(offset, 4, this.length);
|
|
1577
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1637
1578
|
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
1638
1579
|
};
|
|
1639
1580
|
Buffer2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
1640
1581
|
offset = offset >>> 0;
|
|
1641
|
-
if (!noAssert)
|
|
1642
|
-
checkOffset(offset, 4, this.length);
|
|
1582
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1643
1583
|
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
1644
1584
|
};
|
|
1645
1585
|
Buffer2.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
|
|
@@ -1667,35 +1607,28 @@
|
|
|
1667
1607
|
});
|
|
1668
1608
|
Buffer2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
1669
1609
|
offset = offset >>> 0;
|
|
1670
|
-
if (!noAssert)
|
|
1671
|
-
checkOffset(offset, 4, this.length);
|
|
1610
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1672
1611
|
return ieee754.read(this, offset, true, 23, 4);
|
|
1673
1612
|
};
|
|
1674
1613
|
Buffer2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
1675
1614
|
offset = offset >>> 0;
|
|
1676
|
-
if (!noAssert)
|
|
1677
|
-
checkOffset(offset, 4, this.length);
|
|
1615
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1678
1616
|
return ieee754.read(this, offset, false, 23, 4);
|
|
1679
1617
|
};
|
|
1680
1618
|
Buffer2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
1681
1619
|
offset = offset >>> 0;
|
|
1682
|
-
if (!noAssert)
|
|
1683
|
-
checkOffset(offset, 8, this.length);
|
|
1620
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
1684
1621
|
return ieee754.read(this, offset, true, 52, 8);
|
|
1685
1622
|
};
|
|
1686
1623
|
Buffer2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
1687
1624
|
offset = offset >>> 0;
|
|
1688
|
-
if (!noAssert)
|
|
1689
|
-
checkOffset(offset, 8, this.length);
|
|
1625
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
1690
1626
|
return ieee754.read(this, offset, false, 52, 8);
|
|
1691
1627
|
};
|
|
1692
1628
|
function checkInt(buf, value, offset, ext, max, min) {
|
|
1693
|
-
if (!Buffer2.isBuffer(buf))
|
|
1694
|
-
|
|
1695
|
-
if (
|
|
1696
|
-
throw new RangeError('"value" argument is out of bounds');
|
|
1697
|
-
if (offset + ext > buf.length)
|
|
1698
|
-
throw new RangeError("Index out of range");
|
|
1629
|
+
if (!Buffer2.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
1630
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
|
1631
|
+
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
1699
1632
|
}
|
|
1700
1633
|
Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {
|
|
1701
1634
|
value = +value;
|
|
@@ -1732,16 +1665,14 @@
|
|
|
1732
1665
|
Buffer2.prototype.writeUint8 = Buffer2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
1733
1666
|
value = +value;
|
|
1734
1667
|
offset = offset >>> 0;
|
|
1735
|
-
if (!noAssert)
|
|
1736
|
-
checkInt(this, value, offset, 1, 255, 0);
|
|
1668
|
+
if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
|
|
1737
1669
|
this[offset] = value & 255;
|
|
1738
1670
|
return offset + 1;
|
|
1739
1671
|
};
|
|
1740
1672
|
Buffer2.prototype.writeUint16LE = Buffer2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
1741
1673
|
value = +value;
|
|
1742
1674
|
offset = offset >>> 0;
|
|
1743
|
-
if (!noAssert)
|
|
1744
|
-
checkInt(this, value, offset, 2, 65535, 0);
|
|
1675
|
+
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
1745
1676
|
this[offset] = value & 255;
|
|
1746
1677
|
this[offset + 1] = value >>> 8;
|
|
1747
1678
|
return offset + 2;
|
|
@@ -1749,8 +1680,7 @@
|
|
|
1749
1680
|
Buffer2.prototype.writeUint16BE = Buffer2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
1750
1681
|
value = +value;
|
|
1751
1682
|
offset = offset >>> 0;
|
|
1752
|
-
if (!noAssert)
|
|
1753
|
-
checkInt(this, value, offset, 2, 65535, 0);
|
|
1683
|
+
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
1754
1684
|
this[offset] = value >>> 8;
|
|
1755
1685
|
this[offset + 1] = value & 255;
|
|
1756
1686
|
return offset + 2;
|
|
@@ -1758,8 +1688,7 @@
|
|
|
1758
1688
|
Buffer2.prototype.writeUint32LE = Buffer2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
1759
1689
|
value = +value;
|
|
1760
1690
|
offset = offset >>> 0;
|
|
1761
|
-
if (!noAssert)
|
|
1762
|
-
checkInt(this, value, offset, 4, 4294967295, 0);
|
|
1691
|
+
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
1763
1692
|
this[offset + 3] = value >>> 24;
|
|
1764
1693
|
this[offset + 2] = value >>> 16;
|
|
1765
1694
|
this[offset + 1] = value >>> 8;
|
|
@@ -1769,8 +1698,7 @@
|
|
|
1769
1698
|
Buffer2.prototype.writeUint32BE = Buffer2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
1770
1699
|
value = +value;
|
|
1771
1700
|
offset = offset >>> 0;
|
|
1772
|
-
if (!noAssert)
|
|
1773
|
-
checkInt(this, value, offset, 4, 4294967295, 0);
|
|
1701
|
+
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
1774
1702
|
this[offset] = value >>> 24;
|
|
1775
1703
|
this[offset + 1] = value >>> 16;
|
|
1776
1704
|
this[offset + 2] = value >>> 8;
|
|
@@ -1864,18 +1792,15 @@
|
|
|
1864
1792
|
Buffer2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
1865
1793
|
value = +value;
|
|
1866
1794
|
offset = offset >>> 0;
|
|
1867
|
-
if (!noAssert)
|
|
1868
|
-
|
|
1869
|
-
if (value < 0)
|
|
1870
|
-
value = 255 + value + 1;
|
|
1795
|
+
if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
|
|
1796
|
+
if (value < 0) value = 255 + value + 1;
|
|
1871
1797
|
this[offset] = value & 255;
|
|
1872
1798
|
return offset + 1;
|
|
1873
1799
|
};
|
|
1874
1800
|
Buffer2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
1875
1801
|
value = +value;
|
|
1876
1802
|
offset = offset >>> 0;
|
|
1877
|
-
if (!noAssert)
|
|
1878
|
-
checkInt(this, value, offset, 2, 32767, -32768);
|
|
1803
|
+
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
1879
1804
|
this[offset] = value & 255;
|
|
1880
1805
|
this[offset + 1] = value >>> 8;
|
|
1881
1806
|
return offset + 2;
|
|
@@ -1883,8 +1808,7 @@
|
|
|
1883
1808
|
Buffer2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
1884
1809
|
value = +value;
|
|
1885
1810
|
offset = offset >>> 0;
|
|
1886
|
-
if (!noAssert)
|
|
1887
|
-
checkInt(this, value, offset, 2, 32767, -32768);
|
|
1811
|
+
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
1888
1812
|
this[offset] = value >>> 8;
|
|
1889
1813
|
this[offset + 1] = value & 255;
|
|
1890
1814
|
return offset + 2;
|
|
@@ -1892,8 +1816,7 @@
|
|
|
1892
1816
|
Buffer2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
1893
1817
|
value = +value;
|
|
1894
1818
|
offset = offset >>> 0;
|
|
1895
|
-
if (!noAssert)
|
|
1896
|
-
checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
1819
|
+
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
1897
1820
|
this[offset] = value & 255;
|
|
1898
1821
|
this[offset + 1] = value >>> 8;
|
|
1899
1822
|
this[offset + 2] = value >>> 16;
|
|
@@ -1903,10 +1826,8 @@
|
|
|
1903
1826
|
Buffer2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
1904
1827
|
value = +value;
|
|
1905
1828
|
offset = offset >>> 0;
|
|
1906
|
-
if (!noAssert)
|
|
1907
|
-
|
|
1908
|
-
if (value < 0)
|
|
1909
|
-
value = 4294967295 + value + 1;
|
|
1829
|
+
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
1830
|
+
if (value < 0) value = 4294967295 + value + 1;
|
|
1910
1831
|
this[offset] = value >>> 24;
|
|
1911
1832
|
this[offset + 1] = value >>> 16;
|
|
1912
1833
|
this[offset + 2] = value >>> 8;
|
|
@@ -1920,10 +1841,8 @@
|
|
|
1920
1841
|
return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
1921
1842
|
});
|
|
1922
1843
|
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
1923
|
-
if (offset + ext > buf.length)
|
|
1924
|
-
|
|
1925
|
-
if (offset < 0)
|
|
1926
|
-
throw new RangeError("Index out of range");
|
|
1844
|
+
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
1845
|
+
if (offset < 0) throw new RangeError("Index out of range");
|
|
1927
1846
|
}
|
|
1928
1847
|
function writeFloat(buf, value, offset, littleEndian, noAssert) {
|
|
1929
1848
|
value = +value;
|
|
@@ -1956,31 +1875,20 @@
|
|
|
1956
1875
|
return writeDouble(this, value, offset, false, noAssert);
|
|
1957
1876
|
};
|
|
1958
1877
|
Buffer2.prototype.copy = function copy(target, targetStart, start, end) {
|
|
1959
|
-
if (!Buffer2.isBuffer(target))
|
|
1960
|
-
|
|
1961
|
-
if (!
|
|
1962
|
-
|
|
1963
|
-
if (!
|
|
1964
|
-
|
|
1965
|
-
if (
|
|
1966
|
-
|
|
1967
|
-
if (!targetStart)
|
|
1968
|
-
targetStart = 0;
|
|
1969
|
-
if (end > 0 && end < start)
|
|
1970
|
-
end = start;
|
|
1971
|
-
if (end === start)
|
|
1972
|
-
return 0;
|
|
1973
|
-
if (target.length === 0 || this.length === 0)
|
|
1974
|
-
return 0;
|
|
1878
|
+
if (!Buffer2.isBuffer(target)) throw new TypeError("argument should be a Buffer");
|
|
1879
|
+
if (!start) start = 0;
|
|
1880
|
+
if (!end && end !== 0) end = this.length;
|
|
1881
|
+
if (targetStart >= target.length) targetStart = target.length;
|
|
1882
|
+
if (!targetStart) targetStart = 0;
|
|
1883
|
+
if (end > 0 && end < start) end = start;
|
|
1884
|
+
if (end === start) return 0;
|
|
1885
|
+
if (target.length === 0 || this.length === 0) return 0;
|
|
1975
1886
|
if (targetStart < 0) {
|
|
1976
1887
|
throw new RangeError("targetStart out of bounds");
|
|
1977
1888
|
}
|
|
1978
|
-
if (start < 0 || start >= this.length)
|
|
1979
|
-
|
|
1980
|
-
if (end
|
|
1981
|
-
throw new RangeError("sourceEnd out of bounds");
|
|
1982
|
-
if (end > this.length)
|
|
1983
|
-
end = this.length;
|
|
1889
|
+
if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
|
|
1890
|
+
if (end < 0) throw new RangeError("sourceEnd out of bounds");
|
|
1891
|
+
if (end > this.length) end = this.length;
|
|
1984
1892
|
if (target.length - targetStart < end - start) {
|
|
1985
1893
|
end = target.length - targetStart + start;
|
|
1986
1894
|
}
|
|
@@ -2031,8 +1939,7 @@
|
|
|
2031
1939
|
}
|
|
2032
1940
|
start = start >>> 0;
|
|
2033
1941
|
end = end === void 0 ? this.length : end >>> 0;
|
|
2034
|
-
if (!val)
|
|
2035
|
-
val = 0;
|
|
1942
|
+
if (!val) val = 0;
|
|
2036
1943
|
let i;
|
|
2037
1944
|
if (typeof val === "number") {
|
|
2038
1945
|
for (i = start; i < end; ++i) {
|
|
@@ -2171,8 +2078,7 @@
|
|
|
2171
2078
|
function base64clean(str) {
|
|
2172
2079
|
str = str.split("=")[0];
|
|
2173
2080
|
str = str.trim().replace(INVALID_BASE64_RE, "");
|
|
2174
|
-
if (str.length < 2)
|
|
2175
|
-
return "";
|
|
2081
|
+
if (str.length < 2) return "";
|
|
2176
2082
|
while (str.length % 4 !== 0) {
|
|
2177
2083
|
str = str + "=";
|
|
2178
2084
|
}
|
|
@@ -2189,51 +2095,43 @@
|
|
|
2189
2095
|
if (codePoint > 55295 && codePoint < 57344) {
|
|
2190
2096
|
if (!leadSurrogate) {
|
|
2191
2097
|
if (codePoint > 56319) {
|
|
2192
|
-
if ((units -= 3) > -1)
|
|
2193
|
-
bytes.push(239, 191, 189);
|
|
2098
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2194
2099
|
continue;
|
|
2195
2100
|
} else if (i + 1 === length) {
|
|
2196
|
-
if ((units -= 3) > -1)
|
|
2197
|
-
bytes.push(239, 191, 189);
|
|
2101
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2198
2102
|
continue;
|
|
2199
2103
|
}
|
|
2200
2104
|
leadSurrogate = codePoint;
|
|
2201
2105
|
continue;
|
|
2202
2106
|
}
|
|
2203
2107
|
if (codePoint < 56320) {
|
|
2204
|
-
if ((units -= 3) > -1)
|
|
2205
|
-
bytes.push(239, 191, 189);
|
|
2108
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2206
2109
|
leadSurrogate = codePoint;
|
|
2207
2110
|
continue;
|
|
2208
2111
|
}
|
|
2209
2112
|
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
|
|
2210
2113
|
} else if (leadSurrogate) {
|
|
2211
|
-
if ((units -= 3) > -1)
|
|
2212
|
-
bytes.push(239, 191, 189);
|
|
2114
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2213
2115
|
}
|
|
2214
2116
|
leadSurrogate = null;
|
|
2215
2117
|
if (codePoint < 128) {
|
|
2216
|
-
if ((units -= 1) < 0)
|
|
2217
|
-
break;
|
|
2118
|
+
if ((units -= 1) < 0) break;
|
|
2218
2119
|
bytes.push(codePoint);
|
|
2219
2120
|
} else if (codePoint < 2048) {
|
|
2220
|
-
if ((units -= 2) < 0)
|
|
2221
|
-
break;
|
|
2121
|
+
if ((units -= 2) < 0) break;
|
|
2222
2122
|
bytes.push(
|
|
2223
2123
|
codePoint >> 6 | 192,
|
|
2224
2124
|
codePoint & 63 | 128
|
|
2225
2125
|
);
|
|
2226
2126
|
} else if (codePoint < 65536) {
|
|
2227
|
-
if ((units -= 3) < 0)
|
|
2228
|
-
break;
|
|
2127
|
+
if ((units -= 3) < 0) break;
|
|
2229
2128
|
bytes.push(
|
|
2230
2129
|
codePoint >> 12 | 224,
|
|
2231
2130
|
codePoint >> 6 & 63 | 128,
|
|
2232
2131
|
codePoint & 63 | 128
|
|
2233
2132
|
);
|
|
2234
2133
|
} else if (codePoint < 1114112) {
|
|
2235
|
-
if ((units -= 4) < 0)
|
|
2236
|
-
break;
|
|
2134
|
+
if ((units -= 4) < 0) break;
|
|
2237
2135
|
bytes.push(
|
|
2238
2136
|
codePoint >> 18 | 240,
|
|
2239
2137
|
codePoint >> 12 & 63 | 128,
|
|
@@ -2257,8 +2155,7 @@
|
|
|
2257
2155
|
let c, hi, lo;
|
|
2258
2156
|
const byteArray = [];
|
|
2259
2157
|
for (let i = 0; i < str.length; ++i) {
|
|
2260
|
-
if ((units -= 2) < 0)
|
|
2261
|
-
break;
|
|
2158
|
+
if ((units -= 2) < 0) break;
|
|
2262
2159
|
c = str.charCodeAt(i);
|
|
2263
2160
|
hi = c >> 8;
|
|
2264
2161
|
lo = c % 256;
|
|
@@ -2273,8 +2170,7 @@
|
|
|
2273
2170
|
function blitBuffer(src, dst, offset, length) {
|
|
2274
2171
|
let i;
|
|
2275
2172
|
for (i = 0; i < length; ++i) {
|
|
2276
|
-
if (i + offset >= dst.length || i >= src.length)
|
|
2277
|
-
break;
|
|
2173
|
+
if (i + offset >= dst.length || i >= src.length) break;
|
|
2278
2174
|
dst[i + offset] = src[i];
|
|
2279
2175
|
}
|
|
2280
2176
|
return i;
|
|
@@ -2459,10 +2355,8 @@
|
|
|
2459
2355
|
return num << 30 | num >>> 2;
|
|
2460
2356
|
}
|
|
2461
2357
|
function ft(s, b, c, d) {
|
|
2462
|
-
if (s === 0)
|
|
2463
|
-
|
|
2464
|
-
if (s === 2)
|
|
2465
|
-
return b & c | b & d | c & d;
|
|
2358
|
+
if (s === 0) return b & c | ~b & d;
|
|
2359
|
+
if (s === 2) return b & c | b & d | c & d;
|
|
2466
2360
|
return b ^ c ^ d;
|
|
2467
2361
|
}
|
|
2468
2362
|
Sha.prototype._update = function(M) {
|
|
@@ -2472,10 +2366,8 @@
|
|
|
2472
2366
|
var c = this._c | 0;
|
|
2473
2367
|
var d = this._d | 0;
|
|
2474
2368
|
var e = this._e | 0;
|
|
2475
|
-
for (var i = 0; i < 16; ++i)
|
|
2476
|
-
|
|
2477
|
-
for (; i < 80; ++i)
|
|
2478
|
-
W2[i] = W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16];
|
|
2369
|
+
for (var i = 0; i < 16; ++i) W2[i] = M.readInt32BE(i * 4);
|
|
2370
|
+
for (; i < 80; ++i) W2[i] = W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16];
|
|
2479
2371
|
for (var j = 0; j < 80; ++j) {
|
|
2480
2372
|
var s = ~~(j / 20);
|
|
2481
2373
|
var t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K[s] | 0;
|
|
@@ -2541,10 +2433,8 @@
|
|
|
2541
2433
|
return num << 30 | num >>> 2;
|
|
2542
2434
|
}
|
|
2543
2435
|
function ft(s, b, c, d) {
|
|
2544
|
-
if (s === 0)
|
|
2545
|
-
|
|
2546
|
-
if (s === 2)
|
|
2547
|
-
return b & c | b & d | c & d;
|
|
2436
|
+
if (s === 0) return b & c | ~b & d;
|
|
2437
|
+
if (s === 2) return b & c | b & d | c & d;
|
|
2548
2438
|
return b ^ c ^ d;
|
|
2549
2439
|
}
|
|
2550
2440
|
Sha1.prototype._update = function(M) {
|
|
@@ -2554,10 +2444,8 @@
|
|
|
2554
2444
|
var c = this._c | 0;
|
|
2555
2445
|
var d = this._d | 0;
|
|
2556
2446
|
var e = this._e | 0;
|
|
2557
|
-
for (var i = 0; i < 16; ++i)
|
|
2558
|
-
|
|
2559
|
-
for (; i < 80; ++i)
|
|
2560
|
-
W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);
|
|
2447
|
+
for (var i = 0; i < 16; ++i) W2[i] = M.readInt32BE(i * 4);
|
|
2448
|
+
for (; i < 80; ++i) W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);
|
|
2561
2449
|
for (var j = 0; j < 80; ++j) {
|
|
2562
2450
|
var s = ~~(j / 20);
|
|
2563
2451
|
var t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K[s] | 0;
|
|
@@ -2704,10 +2592,8 @@
|
|
|
2704
2592
|
var f = this._f | 0;
|
|
2705
2593
|
var g = this._g | 0;
|
|
2706
2594
|
var h = this._h | 0;
|
|
2707
|
-
for (var i = 0; i < 16; ++i)
|
|
2708
|
-
|
|
2709
|
-
for (; i < 64; ++i)
|
|
2710
|
-
W2[i] = gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16] | 0;
|
|
2595
|
+
for (var i = 0; i < 16; ++i) W2[i] = M.readInt32BE(i * 4);
|
|
2596
|
+
for (; i < 64; ++i) W2[i] = gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16] | 0;
|
|
2711
2597
|
for (var j = 0; j < 64; ++j) {
|
|
2712
2598
|
var T1 = h + sigma1(e) + ch(e, f, g) + K[j] + W2[j] | 0;
|
|
2713
2599
|
var T2 = sigma0(a) + maj(a, b, c) | 0;
|
|
@@ -3184,8 +3070,7 @@
|
|
|
3184
3070
|
var exports = module.exports = function SHA(algorithm) {
|
|
3185
3071
|
algorithm = algorithm.toLowerCase();
|
|
3186
3072
|
var Algorithm = exports[algorithm];
|
|
3187
|
-
if (!Algorithm)
|
|
3188
|
-
throw new Error(algorithm + " is not supported (we accept pull requests)");
|
|
3073
|
+
if (!Algorithm) throw new Error(algorithm + " is not supported (we accept pull requests)");
|
|
3189
3074
|
return new Algorithm();
|
|
3190
3075
|
};
|
|
3191
3076
|
exports.sha = require_sha();
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@xylabs/platform": "^3.3.2",
|
|
18
18
|
"@xylabs/threads": "^3.3.2",
|
|
19
19
|
"@xylabs/typeof": "^3.3.2",
|
|
20
|
-
"@xyo-network/wasm": "~2.
|
|
20
|
+
"@xyo-network/wasm": "~2.100.1",
|
|
21
21
|
"hash-wasm": "^4.11.0",
|
|
22
22
|
"sha.js": "^2.4.11"
|
|
23
23
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@xylabs/delay": "^3.3.2",
|
|
28
28
|
"@xylabs/ts-scripts-yarn3": "^3.10.0",
|
|
29
29
|
"@xylabs/tsconfig": "^3.10.0",
|
|
30
|
-
"esbuild": "^0.
|
|
30
|
+
"esbuild": "^0.21.1",
|
|
31
31
|
"typescript": "^5.4.5"
|
|
32
32
|
},
|
|
33
33
|
"exports": {
|
|
@@ -75,6 +75,6 @@
|
|
|
75
75
|
"package-compile": "package-compile-only && yarn bundle"
|
|
76
76
|
},
|
|
77
77
|
"sideEffects": false,
|
|
78
|
-
"version": "2.
|
|
78
|
+
"version": "2.100.1",
|
|
79
79
|
"type": "module"
|
|
80
80
|
}
|