@file-viewer/renderer-ofd 2.1.22 → 2.1.24
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/README.en.md +1 -0
- package/README.md +1 -0
- package/dist/ofd.js +10 -4
- package/package.json +5 -3
- package/vendor/dltech/ofd/ofd_parser.js +143 -19
- package/vendor/dltech/ofd/ofd_render.js +9 -9
- package/vendor/dltech/ofd/ofd_util.js +16 -5
- package/vendor/dltech/ofd/ses_signature_parser.js +196 -0
- package/vendor/lapo-asn1js/README.md +3 -0
- package/vendor/lapo-asn1js/asn1.js +525 -0
- package/vendor/lapo-asn1js/base64.js +82 -0
- package/vendor/lapo-asn1js/hex.js +51 -0
- package/vendor/lapo-asn1js/int10.js +90 -0
- package/vendor/lapo-asn1js/oids.js +2455 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var max = 10000000000000; // biggest 10^n integer that can still fit 2^53 when multiplied by 256
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Arbitrary length base-10 value.
|
|
5
|
+
* @param {number} value - Optional initial value (will be 0 otherwise).
|
|
6
|
+
*/
|
|
7
|
+
function Int10(value) {
|
|
8
|
+
this.buf = [+value || 0];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Multiply value by m and add c.
|
|
13
|
+
* @param {number} m - multiplier, must be < =256
|
|
14
|
+
* @param {number} c - value to add
|
|
15
|
+
*/
|
|
16
|
+
Int10.prototype.mulAdd = function (m, c) {
|
|
17
|
+
// assert(m <= 256)
|
|
18
|
+
var b = this.buf,
|
|
19
|
+
l = b.length,
|
|
20
|
+
i, t;
|
|
21
|
+
for (i = 0; i < l; ++i) {
|
|
22
|
+
t = b[i] * m + c;
|
|
23
|
+
if (t < max)
|
|
24
|
+
c = 0;
|
|
25
|
+
else {
|
|
26
|
+
c = 0|(t / max);
|
|
27
|
+
t -= c * max;
|
|
28
|
+
}
|
|
29
|
+
b[i] = t;
|
|
30
|
+
}
|
|
31
|
+
if (c > 0)
|
|
32
|
+
b[i] = c;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Subtract value.
|
|
37
|
+
* @param {number} c - value to subtract
|
|
38
|
+
*/
|
|
39
|
+
Int10.prototype.sub = function (c) {
|
|
40
|
+
var b = this.buf,
|
|
41
|
+
l = b.length,
|
|
42
|
+
i, t;
|
|
43
|
+
for (i = 0; i < l; ++i) {
|
|
44
|
+
t = b[i] - c;
|
|
45
|
+
if (t < 0) {
|
|
46
|
+
t += max;
|
|
47
|
+
c = 1;
|
|
48
|
+
} else
|
|
49
|
+
c = 0;
|
|
50
|
+
b[i] = t;
|
|
51
|
+
}
|
|
52
|
+
while (b[b.length - 1] === 0)
|
|
53
|
+
b.pop();
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Convert to decimal string representation.
|
|
58
|
+
* @param {*} base - optional value, only value accepted is 10
|
|
59
|
+
*/
|
|
60
|
+
Int10.prototype.toString = function (base) {
|
|
61
|
+
if ((base || 10) != 10)
|
|
62
|
+
throw 'only base 10 is supported';
|
|
63
|
+
var b = this.buf,
|
|
64
|
+
s = b[b.length - 1].toString();
|
|
65
|
+
for (var i = b.length - 2; i >= 0; --i)
|
|
66
|
+
s += (max + b[i]).toString().substring(1);
|
|
67
|
+
return s;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Convert to Number value representation.
|
|
72
|
+
* Will probably overflow 2^53 and thus become approximate.
|
|
73
|
+
*/
|
|
74
|
+
Int10.prototype.valueOf = function () {
|
|
75
|
+
var b = this.buf,
|
|
76
|
+
v = 0;
|
|
77
|
+
for (var i = b.length - 1; i >= 0; --i)
|
|
78
|
+
v = v * max + b[i];
|
|
79
|
+
return v;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Return value as a simple Number (if it is <= 10000000000000), or return this.
|
|
84
|
+
*/
|
|
85
|
+
Int10.prototype.simplify = function () {
|
|
86
|
+
var b = this.buf;
|
|
87
|
+
return (b.length == 1) ? b[0] : this;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default Int10;
|