Merge pull request #13401 from Snuffleupagus/rm-some-prettier-ignore
Remove some, with Prettier `2.3.0`, unnecessary `// prettier-ignore` comments
This commit is contained in:
commit
7d9a83012b
@ -76,14 +76,13 @@ class ARCFourCipher {
|
||||
}
|
||||
|
||||
const calculateMD5 = (function calculateMD5Closure() {
|
||||
// prettier-ignore
|
||||
const r = new Uint8Array([
|
||||
7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
|
||||
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
|
||||
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
|
||||
6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]);
|
||||
7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5,
|
||||
9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11,
|
||||
16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10,
|
||||
15, 21,
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
const k = new Int32Array([
|
||||
-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426,
|
||||
-1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162,
|
||||
@ -95,7 +94,8 @@ const calculateMD5 = (function calculateMD5Closure() {
|
||||
-722521979, 76029189, -640364487, -421815835, 530742520, -995338651,
|
||||
-198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606,
|
||||
-1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649,
|
||||
-145523070, -1120210379, 718787259, -343485551]);
|
||||
-145523070, -1120210379, 718787259, -343485551,
|
||||
]);
|
||||
|
||||
function hash(data, offset, length) {
|
||||
let h0 = 1732584193,
|
||||
@ -292,23 +292,19 @@ const calculateSHA256 = (function calculateSHA256Closure() {
|
||||
return rotr(x, 17) ^ rotr(x, 19) ^ (x >>> 10);
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
const k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
|
||||
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
||||
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
||||
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
||||
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
|
||||
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
|
||||
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
||||
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
||||
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
||||
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
|
||||
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
|
||||
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
||||
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
||||
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
|
||||
const k = [
|
||||
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
|
||||
0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
||||
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
|
||||
0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
|
||||
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
||||
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
|
||||
0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
|
||||
0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
||||
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
||||
];
|
||||
|
||||
function hash(data, offset, length) {
|
||||
// initial hash values
|
||||
@ -701,7 +697,6 @@ class AESBaseCipher {
|
||||
unreachable("Cannot initialize AESBaseCipher.");
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
this._s = new Uint8Array([
|
||||
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b,
|
||||
0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
|
||||
@ -727,7 +722,6 @@ class AESBaseCipher {
|
||||
0xb0, 0x54, 0xbb, 0x16,
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
this._inv_s = new Uint8Array([
|
||||
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e,
|
||||
0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87,
|
||||
@ -753,7 +747,6 @@ class AESBaseCipher {
|
||||
0x55, 0x21, 0x0c, 0x7d,
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
this._mix = new Uint32Array([
|
||||
0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927,
|
||||
0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45,
|
||||
@ -1124,7 +1117,6 @@ class AES128Cipher extends AESBaseCipher {
|
||||
this._cyclesOfRepetition = 10;
|
||||
this._keySize = 160; // bits
|
||||
|
||||
// prettier-ignore
|
||||
this._rcon = new Uint8Array([
|
||||
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c,
|
||||
0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a,
|
||||
@ -1448,12 +1440,11 @@ class CipherTransform {
|
||||
}
|
||||
|
||||
const CipherTransformFactory = (function CipherTransformFactoryClosure() {
|
||||
// prettier-ignore
|
||||
const defaultPasswordBytes = new Uint8Array([
|
||||
0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41,
|
||||
0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08,
|
||||
0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80,
|
||||
0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A]);
|
||||
0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56,
|
||||
0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80,
|
||||
0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a,
|
||||
]);
|
||||
|
||||
function createEncryptionKey20(
|
||||
revision,
|
||||
|
@ -524,9 +524,9 @@ class Page {
|
||||
}
|
||||
|
||||
const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
|
||||
// prettier-ignore
|
||||
const STARTXREF_SIGNATURE = new Uint8Array([
|
||||
0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
|
||||
0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66,
|
||||
]);
|
||||
const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
|
||||
|
||||
const FINGERPRINT_FIRST_BYTES = 1024;
|
||||
|
@ -22,102 +22,103 @@
|
||||
import { DecodeStream } from "./decode_stream.js";
|
||||
import { FormatError } from "../shared/util.js";
|
||||
|
||||
// prettier-ignore
|
||||
const codeLenCodeMap = new Int32Array([
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15,
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
const lengthDecode = new Int32Array([
|
||||
0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a,
|
||||
0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f,
|
||||
0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073,
|
||||
0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102
|
||||
0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102,
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
const distDecode = new Int32Array([
|
||||
0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d,
|
||||
0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1,
|
||||
0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01,
|
||||
0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001
|
||||
0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001,
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
const fixedLitCodeTab = [new Int32Array([
|
||||
0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0,
|
||||
0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0,
|
||||
0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0,
|
||||
0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0,
|
||||
0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8,
|
||||
0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8,
|
||||
0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8,
|
||||
0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8,
|
||||
0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4,
|
||||
0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4,
|
||||
0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4,
|
||||
0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4,
|
||||
0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc,
|
||||
0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec,
|
||||
0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc,
|
||||
0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc,
|
||||
0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2,
|
||||
0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2,
|
||||
0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2,
|
||||
0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2,
|
||||
0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca,
|
||||
0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea,
|
||||
0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da,
|
||||
0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa,
|
||||
0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6,
|
||||
0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6,
|
||||
0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6,
|
||||
0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6,
|
||||
0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce,
|
||||
0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee,
|
||||
0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de,
|
||||
0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe,
|
||||
0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1,
|
||||
0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1,
|
||||
0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1,
|
||||
0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1,
|
||||
0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9,
|
||||
0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9,
|
||||
0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9,
|
||||
0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9,
|
||||
0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5,
|
||||
0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5,
|
||||
0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5,
|
||||
0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5,
|
||||
0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd,
|
||||
0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed,
|
||||
0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd,
|
||||
0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd,
|
||||
0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3,
|
||||
0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3,
|
||||
0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3,
|
||||
0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3,
|
||||
0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb,
|
||||
0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb,
|
||||
0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db,
|
||||
0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb,
|
||||
0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7,
|
||||
0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7,
|
||||
0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7,
|
||||
0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7,
|
||||
0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf,
|
||||
0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef,
|
||||
0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df,
|
||||
0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff
|
||||
]), 9];
|
||||
const fixedLitCodeTab = [
|
||||
new Int32Array([
|
||||
0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0,
|
||||
0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0,
|
||||
0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0,
|
||||
0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0,
|
||||
0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8,
|
||||
0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8,
|
||||
0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8,
|
||||
0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8,
|
||||
0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4,
|
||||
0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4,
|
||||
0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4,
|
||||
0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4,
|
||||
0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc,
|
||||
0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec,
|
||||
0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc,
|
||||
0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc,
|
||||
0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2,
|
||||
0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2,
|
||||
0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2,
|
||||
0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2,
|
||||
0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca,
|
||||
0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea,
|
||||
0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da,
|
||||
0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa,
|
||||
0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6,
|
||||
0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6,
|
||||
0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6,
|
||||
0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6,
|
||||
0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce,
|
||||
0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee,
|
||||
0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de,
|
||||
0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe,
|
||||
0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1,
|
||||
0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1,
|
||||
0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1,
|
||||
0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1,
|
||||
0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9,
|
||||
0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9,
|
||||
0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9,
|
||||
0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9,
|
||||
0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5,
|
||||
0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5,
|
||||
0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5,
|
||||
0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5,
|
||||
0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd,
|
||||
0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed,
|
||||
0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd,
|
||||
0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd,
|
||||
0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3,
|
||||
0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3,
|
||||
0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3,
|
||||
0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3,
|
||||
0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb,
|
||||
0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb,
|
||||
0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db,
|
||||
0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb,
|
||||
0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7,
|
||||
0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7,
|
||||
0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7,
|
||||
0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7,
|
||||
0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf,
|
||||
0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef,
|
||||
0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df,
|
||||
0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff,
|
||||
]),
|
||||
9,
|
||||
];
|
||||
|
||||
// prettier-ignore
|
||||
const fixedDistCodeTab = [new Int32Array([
|
||||
0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c,
|
||||
0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000,
|
||||
0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d,
|
||||
0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000
|
||||
]), 5];
|
||||
const fixedDistCodeTab = [
|
||||
new Int32Array([
|
||||
0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c,
|
||||
0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000,
|
||||
0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d,
|
||||
0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000,
|
||||
]),
|
||||
5,
|
||||
];
|
||||
|
||||
class FlateStream extends DecodeStream {
|
||||
constructor(str, maybeLength) {
|
||||
|
@ -1968,15 +1968,15 @@ class Font {
|
||||
|
||||
// prettier-ignore
|
||||
const TTOpsStackDeltas = [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1,
|
||||
1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1,
|
||||
0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2,
|
||||
0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1,
|
||||
-1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1,
|
||||
-1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
-2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1,
|
||||
-999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2];
|
||||
0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1,
|
||||
1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1,
|
||||
0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2,
|
||||
0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1,
|
||||
-1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1,
|
||||
-1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
-2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1,
|
||||
-999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2];
|
||||
// 0xC0-DF == -1 and 0xE0-FF == -2
|
||||
|
||||
function sanitizeTTProgram(table, ttContext) {
|
||||
|
@ -46,22 +46,22 @@ class EOIMarkerError extends BaseException {}
|
||||
|
||||
// prettier-ignore
|
||||
const dctZigZag = new Uint8Array([
|
||||
0,
|
||||
1, 8,
|
||||
16, 9, 2,
|
||||
3, 10, 17, 24,
|
||||
32, 25, 18, 11, 4,
|
||||
5, 12, 19, 26, 33, 40,
|
||||
48, 41, 34, 27, 20, 13, 6,
|
||||
7, 14, 21, 28, 35, 42, 49, 56,
|
||||
57, 50, 43, 36, 29, 22, 15,
|
||||
23, 30, 37, 44, 51, 58,
|
||||
59, 52, 45, 38, 31,
|
||||
39, 46, 53, 60,
|
||||
61, 54, 47,
|
||||
55, 62,
|
||||
63
|
||||
]);
|
||||
0,
|
||||
1, 8,
|
||||
16, 9, 2,
|
||||
3, 10, 17, 24,
|
||||
32, 25, 18, 11, 4,
|
||||
5, 12, 19, 26, 33, 40,
|
||||
48, 41, 34, 27, 20, 13, 6,
|
||||
7, 14, 21, 28, 35, 42, 49, 56,
|
||||
57, 50, 43, 36, 29, 22, 15,
|
||||
23, 30, 37, 44, 51, 58,
|
||||
59, 52, 45, 38, 31,
|
||||
39, 46, 53, 60,
|
||||
61, 54, 47,
|
||||
55, 62,
|
||||
63
|
||||
]);
|
||||
|
||||
const dctCos1 = 4017; // cos(pi/16)
|
||||
const dctSin1 = 799; // sin(pi/16)
|
||||
@ -1158,9 +1158,7 @@ class JpegImage {
|
||||
// inverting JPEG (CMYK) images if and only if the image data does *not*
|
||||
// come from a PDF file and no `decodeTransform` was passed by the user.
|
||||
if (!isSourcePDF && numComponents === 4 && !transform) {
|
||||
// prettier-ignore
|
||||
transform = new Int32Array([
|
||||
-256, 255, -256, 255, -256, 255, -256, 255]);
|
||||
transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
|
||||
}
|
||||
|
||||
if (transform) {
|
||||
|
@ -1733,24 +1733,21 @@ const BitModel = (function BitModelClosure() {
|
||||
// Table D-1
|
||||
// The index is binary presentation: 0dddvvhh, ddd - sum of Di (0..4),
|
||||
// vv - sum of Vi (0..2), and hh - sum of Hi (0..2)
|
||||
// prettier-ignore
|
||||
const LLAndLHContextsLabel = new Uint8Array([
|
||||
0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4,
|
||||
7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6,
|
||||
8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8
|
||||
]);
|
||||
// prettier-ignore
|
||||
0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4,
|
||||
7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6,
|
||||
8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8,
|
||||
]);
|
||||
const HLContextLabel = new Uint8Array([
|
||||
0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8,
|
||||
8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3,
|
||||
4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8
|
||||
]);
|
||||
// prettier-ignore
|
||||
0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8,
|
||||
8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3,
|
||||
4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8,
|
||||
]);
|
||||
const HHContextLabel = new Uint8Array([
|
||||
0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5,
|
||||
5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8,
|
||||
8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8
|
||||
]);
|
||||
0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5,
|
||||
5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8,
|
||||
8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8,
|
||||
]);
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
class BitModel {
|
||||
|
@ -635,9 +635,9 @@ class Parser {
|
||||
this.shift(); // 'stream'
|
||||
} else {
|
||||
// Bad stream length, scanning for endstream command.
|
||||
// prettier-ignore
|
||||
const ENDSTREAM_SIGNATURE = new Uint8Array([
|
||||
0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]);
|
||||
0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d,
|
||||
]);
|
||||
let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
|
||||
if (actualLength < 0) {
|
||||
// Only allow limited truncation of the endstream signature,
|
||||
|
@ -408,9 +408,9 @@ class XRef {
|
||||
const CHECK_CONTENT_LENGTH = 25;
|
||||
|
||||
const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
|
||||
// prettier-ignore
|
||||
const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114,
|
||||
101, 102]);
|
||||
const startxrefBytes = new Uint8Array([
|
||||
115, 116, 97, 114, 116, 120, 114, 101, 102,
|
||||
]);
|
||||
const objBytes = new Uint8Array([111, 98, 106]);
|
||||
const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
|
||||
|
||||
|
@ -227,15 +227,15 @@ class CachedCanvases {
|
||||
|
||||
function compileType3Glyph(imgData) {
|
||||
const POINT_TO_PROCESS_LIMIT = 1000;
|
||||
const POINT_TYPES = new Uint8Array([
|
||||
0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0,
|
||||
]);
|
||||
|
||||
const width = imgData.width,
|
||||
height = imgData.height,
|
||||
width1 = width + 1;
|
||||
let i, ii, j, j0;
|
||||
const points = new Uint8Array(width1 * (height + 1));
|
||||
// prettier-ignore
|
||||
const POINT_TYPES =
|
||||
new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);
|
||||
|
||||
// decodes bit-packed mask data
|
||||
const lineSize = (width + 7) & ~7,
|
||||
|
@ -795,17 +795,16 @@ class Util {
|
||||
}
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
const PDFStringTranslateTable = [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8,
|
||||
0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014,
|
||||
0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C,
|
||||
0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160,
|
||||
0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192,
|
||||
0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018,
|
||||
0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d,
|
||||
0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac,
|
||||
];
|
||||
|
||||
function stringToPDFString(str) {
|
||||
|
@ -123,10 +123,9 @@ describe("CFFParser", function () {
|
||||
"ignores reserved commands in parseDict, and refuses to add privateDict " +
|
||||
"keys with invalid values (bug 1308536)",
|
||||
function () {
|
||||
// prettier-ignore
|
||||
const bytes = new Uint8Array([
|
||||
64, 39, 31, 30, 252, 114, 137, 115, 79, 30, 197, 119, 2, 99, 127, 6
|
||||
]);
|
||||
64, 39, 31, 30, 252, 114, 137, 115, 79, 30, 197, 119, 2, 99, 127, 6,
|
||||
]);
|
||||
parser.bytes = bytes;
|
||||
const topDict = cff.topDict;
|
||||
topDict.setByName("Private", [bytes.length, 0]);
|
||||
|
@ -355,16 +355,13 @@ describe("crypto", function () {
|
||||
it("should correctly check a user key", function () {
|
||||
const alg = new PDF17();
|
||||
const password = new Uint8Array([117, 115, 101, 114]);
|
||||
// prettier-ignore
|
||||
const userValidation = new Uint8Array([
|
||||
117, 169, 4, 32, 159, 101, 22, 220
|
||||
117, 169, 4, 32, 159, 101, 22, 220,
|
||||
]);
|
||||
// prettier-ignore
|
||||
const userPassword = new Uint8Array([
|
||||
131, 242, 143, 160, 87, 2, 138, 134, 79,
|
||||
253, 189, 173, 224, 73, 144, 241, 190, 81,
|
||||
197, 15, 249, 105, 145, 151, 15, 194, 65,
|
||||
3, 1, 126, 187, 221
|
||||
131, 242, 143, 160, 87, 2, 138, 134, 79, 253, 189, 173, 224, 73, 144,
|
||||
241, 190, 81, 197, 15, 249, 105, 145, 151, 15, 194, 65, 3, 1, 126, 187,
|
||||
221,
|
||||
]);
|
||||
const result = alg.checkUserPassword(
|
||||
password,
|
||||
@ -377,24 +374,19 @@ describe("crypto", function () {
|
||||
it("should correctly check an owner key", function () {
|
||||
const alg = new PDF17();
|
||||
const password = new Uint8Array([111, 119, 110, 101, 114]);
|
||||
// prettier-ignore
|
||||
const ownerValidation = new Uint8Array([
|
||||
243, 118, 71, 153, 128, 17, 101, 62
|
||||
243, 118, 71, 153, 128, 17, 101, 62,
|
||||
]);
|
||||
// prettier-ignore
|
||||
const ownerPassword = new Uint8Array([
|
||||
60, 98, 137, 35, 51, 101, 200, 152, 210,
|
||||
178, 226, 228, 134, 205, 163, 24, 204,
|
||||
126, 177, 36, 106, 50, 36, 125, 210, 172,
|
||||
171, 120, 222, 108, 139, 115
|
||||
60, 98, 137, 35, 51, 101, 200, 152, 210, 178, 226, 228, 134, 205, 163,
|
||||
24, 204, 126, 177, 36, 106, 50, 36, 125, 210, 172, 171, 120, 222, 108,
|
||||
139, 115,
|
||||
]);
|
||||
// prettier-ignore
|
||||
const uBytes = new Uint8Array([
|
||||
131, 242, 143, 160, 87, 2, 138, 134, 79, 253,
|
||||
189, 173, 224, 73, 144, 241, 190, 81, 197, 15,
|
||||
249, 105, 145, 151, 15, 194, 65, 3, 1, 126, 187,
|
||||
221, 117, 169, 4, 32, 159, 101, 22, 220, 168,
|
||||
94, 215, 192, 100, 38, 188, 40
|
||||
131, 242, 143, 160, 87, 2, 138, 134, 79, 253, 189, 173, 224, 73, 144,
|
||||
241, 190, 81, 197, 15, 249, 105, 145, 151, 15, 194, 65, 3, 1, 126, 187,
|
||||
221, 117, 169, 4, 32, 159, 101, 22, 220, 168, 94, 215, 192, 100, 38,
|
||||
188, 40,
|
||||
]);
|
||||
const result = alg.checkOwnerPassword(
|
||||
password,
|
||||
@ -409,20 +401,15 @@ describe("crypto", function () {
|
||||
const alg = new PDF17();
|
||||
const password = new Uint8Array([117, 115, 101, 114]);
|
||||
const userKeySalt = new Uint8Array([168, 94, 215, 192, 100, 38, 188, 40]);
|
||||
// prettier-ignore
|
||||
const userEncryption = new Uint8Array([
|
||||
35, 150, 195, 169, 245, 51, 51, 255,
|
||||
158, 158, 33, 242, 231, 75, 125, 190,
|
||||
25, 126, 172, 114, 195, 244, 137, 245,
|
||||
234, 165, 42, 74, 60, 38, 17, 17
|
||||
35, 150, 195, 169, 245, 51, 51, 255, 158, 158, 33, 242, 231, 75, 125,
|
||||
190, 25, 126, 172, 114, 195, 244, 137, 245, 234, 165, 42, 74, 60, 38,
|
||||
17, 17,
|
||||
]);
|
||||
const result = alg.getUserKey(password, userKeySalt, userEncryption);
|
||||
// prettier-ignore
|
||||
const expected = new Uint8Array([
|
||||
63, 114, 136, 209, 87, 61, 12, 30, 249, 1,
|
||||
186, 144, 254, 248, 163, 153, 151, 51, 133,
|
||||
10, 80, 152, 206, 15, 72, 187, 231, 33, 224,
|
||||
239, 13, 213
|
||||
63, 114, 136, 209, 87, 61, 12, 30, 249, 1, 186, 144, 254, 248, 163, 153,
|
||||
151, 51, 133, 10, 80, 152, 206, 15, 72, 187, 231, 33, 224, 239, 13, 213,
|
||||
]);
|
||||
expect(result).toEqual(expected);
|
||||
});
|
||||
@ -430,24 +417,18 @@ describe("crypto", function () {
|
||||
it("should generate a file encryption key from the owner key", function () {
|
||||
const alg = new PDF17();
|
||||
const password = new Uint8Array([111, 119, 110, 101, 114]);
|
||||
// prettier-ignore
|
||||
const ownerKeySalt = new Uint8Array([
|
||||
200, 245, 242, 12, 218, 123, 24, 120
|
||||
200, 245, 242, 12, 218, 123, 24, 120,
|
||||
]);
|
||||
// prettier-ignore
|
||||
const ownerEncryption = new Uint8Array([
|
||||
213, 202, 14, 189, 110, 76, 70, 191, 6,
|
||||
195, 10, 190, 157, 100, 144, 85, 8, 62,
|
||||
123, 178, 156, 229, 50, 40, 229, 216,
|
||||
54, 222, 34, 38, 106, 223
|
||||
213, 202, 14, 189, 110, 76, 70, 191, 6, 195, 10, 190, 157, 100, 144, 85,
|
||||
8, 62, 123, 178, 156, 229, 50, 40, 229, 216, 54, 222, 34, 38, 106, 223,
|
||||
]);
|
||||
// prettier-ignore
|
||||
const uBytes = new Uint8Array([
|
||||
131, 242, 143, 160, 87, 2, 138, 134, 79, 253,
|
||||
189, 173, 224, 73, 144, 241, 190, 81, 197, 15,
|
||||
249, 105, 145, 151, 15, 194, 65, 3, 1, 126, 187,
|
||||
221, 117, 169, 4, 32, 159, 101, 22, 220, 168,
|
||||
94, 215, 192, 100, 38, 188, 40
|
||||
131, 242, 143, 160, 87, 2, 138, 134, 79, 253, 189, 173, 224, 73, 144,
|
||||
241, 190, 81, 197, 15, 249, 105, 145, 151, 15, 194, 65, 3, 1, 126, 187,
|
||||
221, 117, 169, 4, 32, 159, 101, 22, 220, 168, 94, 215, 192, 100, 38,
|
||||
188, 40,
|
||||
]);
|
||||
const result = alg.getOwnerKey(
|
||||
password,
|
||||
@ -455,12 +436,9 @@ describe("crypto", function () {
|
||||
uBytes,
|
||||
ownerEncryption
|
||||
);
|
||||
// prettier-ignore
|
||||
const expected = new Uint8Array([
|
||||
63, 114, 136, 209, 87, 61, 12, 30, 249, 1,
|
||||
186, 144, 254, 248, 163, 153, 151, 51, 133,
|
||||
10, 80, 152, 206, 15, 72, 187, 231, 33, 224,
|
||||
239, 13, 213
|
||||
63, 114, 136, 209, 87, 61, 12, 30, 249, 1, 186, 144, 254, 248, 163, 153,
|
||||
151, 51, 133, 10, 80, 152, 206, 15, 72, 187, 231, 33, 224, 239, 13, 213,
|
||||
]);
|
||||
expect(result).toEqual(expected);
|
||||
});
|
||||
@ -470,16 +448,13 @@ describe("crypto", function () {
|
||||
it("should correctly check a user key", function () {
|
||||
const alg = new PDF20();
|
||||
const password = new Uint8Array([117, 115, 101, 114]);
|
||||
// prettier-ignore
|
||||
const userValidation = new Uint8Array([
|
||||
83, 245, 146, 101, 198, 247, 34, 198
|
||||
83, 245, 146, 101, 198, 247, 34, 198,
|
||||
]);
|
||||
// prettier-ignore
|
||||
const userPassword = new Uint8Array([
|
||||
94, 230, 205, 75, 166, 99, 250, 76, 219,
|
||||
128, 17, 85, 57, 17, 33, 164, 150, 46,
|
||||
103, 176, 160, 156, 187, 233, 166, 223,
|
||||
163, 253, 147, 235, 95, 184
|
||||
94, 230, 205, 75, 166, 99, 250, 76, 219, 128, 17, 85, 57, 17, 33, 164,
|
||||
150, 46, 103, 176, 160, 156, 187, 233, 166, 223, 163, 253, 147, 235, 95,
|
||||
184,
|
||||
]);
|
||||
const result = alg.checkUserPassword(
|
||||
password,
|
||||
@ -492,24 +467,18 @@ describe("crypto", function () {
|
||||
it("should correctly check an owner key", function () {
|
||||
const alg = new PDF20();
|
||||
const password = new Uint8Array([111, 119, 110, 101, 114]);
|
||||
// prettier-ignore
|
||||
const ownerValidation = new Uint8Array([
|
||||
142, 232, 169, 208, 202, 214, 5, 185
|
||||
142, 232, 169, 208, 202, 214, 5, 185,
|
||||
]);
|
||||
// prettier-ignore
|
||||
const ownerPassword = new Uint8Array([
|
||||
88, 232, 62, 54, 245, 26, 245, 209, 137,
|
||||
123, 221, 72, 199, 49, 37, 217, 31, 74,
|
||||
115, 167, 127, 158, 176, 77, 45, 163, 87,
|
||||
47, 39, 90, 217, 141
|
||||
88, 232, 62, 54, 245, 26, 245, 209, 137, 123, 221, 72, 199, 49, 37, 217,
|
||||
31, 74, 115, 167, 127, 158, 176, 77, 45, 163, 87, 47, 39, 90, 217, 141,
|
||||
]);
|
||||
// prettier-ignore
|
||||
const uBytes = new Uint8Array([
|
||||
94, 230, 205, 75, 166, 99, 250, 76, 219, 128,
|
||||
17, 85, 57, 17, 33, 164, 150, 46, 103, 176, 160,
|
||||
156, 187, 233, 166, 223, 163, 253, 147, 235, 95,
|
||||
184, 83, 245, 146, 101, 198, 247, 34, 198, 191,
|
||||
11, 16, 94, 237, 216, 20, 175
|
||||
94, 230, 205, 75, 166, 99, 250, 76, 219, 128, 17, 85, 57, 17, 33, 164,
|
||||
150, 46, 103, 176, 160, 156, 187, 233, 166, 223, 163, 253, 147, 235, 95,
|
||||
184, 83, 245, 146, 101, 198, 247, 34, 198, 191, 11, 16, 94, 237, 216,
|
||||
20, 175,
|
||||
]);
|
||||
const result = alg.checkOwnerPassword(
|
||||
password,
|
||||
@ -524,20 +493,15 @@ describe("crypto", function () {
|
||||
const alg = new PDF20();
|
||||
const password = new Uint8Array([117, 115, 101, 114]);
|
||||
const userKeySalt = new Uint8Array([191, 11, 16, 94, 237, 216, 20, 175]);
|
||||
// prettier-ignore
|
||||
const userEncryption = new Uint8Array([
|
||||
121, 208, 2, 181, 230, 89, 156, 60, 253,
|
||||
143, 212, 28, 84, 180, 196, 177, 173,
|
||||
128, 221, 107, 46, 20, 94, 186, 135, 51,
|
||||
95, 24, 20, 223, 254, 36
|
||||
121, 208, 2, 181, 230, 89, 156, 60, 253, 143, 212, 28, 84, 180, 196,
|
||||
177, 173, 128, 221, 107, 46, 20, 94, 186, 135, 51, 95, 24, 20, 223, 254,
|
||||
36,
|
||||
]);
|
||||
const result = alg.getUserKey(password, userKeySalt, userEncryption);
|
||||
// prettier-ignore
|
||||
const expected = new Uint8Array([
|
||||
42, 218, 213, 39, 73, 91, 72, 79, 67, 38, 248,
|
||||
133, 18, 189, 61, 34, 107, 79, 29, 56, 59,
|
||||
181, 213, 118, 113, 34, 65, 210, 87, 174, 22,
|
||||
239
|
||||
42, 218, 213, 39, 73, 91, 72, 79, 67, 38, 248, 133, 18, 189, 61, 34,
|
||||
107, 79, 29, 56, 59, 181, 213, 118, 113, 34, 65, 210, 87, 174, 22, 239,
|
||||
]);
|
||||
expect(result).toEqual(expected);
|
||||
});
|
||||
@ -546,20 +510,16 @@ describe("crypto", function () {
|
||||
const alg = new PDF20();
|
||||
const password = new Uint8Array([111, 119, 110, 101, 114]);
|
||||
const ownerKeySalt = new Uint8Array([29, 208, 185, 46, 11, 76, 135, 149]);
|
||||
// prettier-ignore
|
||||
const ownerEncryption = new Uint8Array([
|
||||
209, 73, 224, 77, 103, 155, 201, 181,
|
||||
190, 68, 223, 20, 62, 90, 56, 210, 5,
|
||||
240, 178, 128, 238, 124, 68, 254, 253,
|
||||
244, 62, 108, 208, 135, 10, 251
|
||||
209, 73, 224, 77, 103, 155, 201, 181, 190, 68, 223, 20, 62, 90, 56, 210,
|
||||
5, 240, 178, 128, 238, 124, 68, 254, 253, 244, 62, 108, 208, 135, 10,
|
||||
251,
|
||||
]);
|
||||
// prettier-ignore
|
||||
const uBytes = new Uint8Array([
|
||||
94, 230, 205, 75, 166, 99, 250, 76, 219, 128,
|
||||
17, 85, 57, 17, 33, 164, 150, 46, 103, 176, 160,
|
||||
156, 187, 233, 166, 223, 163, 253, 147, 235, 95,
|
||||
184, 83, 245, 146, 101, 198, 247, 34, 198, 191,
|
||||
11, 16, 94, 237, 216, 20, 175
|
||||
94, 230, 205, 75, 166, 99, 250, 76, 219, 128, 17, 85, 57, 17, 33, 164,
|
||||
150, 46, 103, 176, 160, 156, 187, 233, 166, 223, 163, 253, 147, 235, 95,
|
||||
184, 83, 245, 146, 101, 198, 247, 34, 198, 191, 11, 16, 94, 237, 216,
|
||||
20, 175,
|
||||
]);
|
||||
const result = alg.getOwnerKey(
|
||||
password,
|
||||
@ -567,12 +527,9 @@ describe("crypto", function () {
|
||||
uBytes,
|
||||
ownerEncryption
|
||||
);
|
||||
// prettier-ignore
|
||||
const expected = new Uint8Array([
|
||||
42, 218, 213, 39, 73, 91, 72, 79, 67, 38, 248,
|
||||
133, 18, 189, 61, 34, 107, 79, 29, 56, 59,
|
||||
181, 213, 118, 113, 34, 65, 210, 87, 174, 22,
|
||||
239
|
||||
42, 218, 213, 39, 73, 91, 72, 79, 67, 38, 248, 133, 18, 189, 61, 34,
|
||||
107, 79, 29, 56, 59, 181, 213, 118, 113, 34, 65, 210, 87, 174, 22, 239,
|
||||
]);
|
||||
expect(result).toEqual(expected);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user