@medicus.ai/medicus-report-pdf-generator 1.0.231 → 1.0.232
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/assets/corporate_report/css/report.css +14 -38
- package/assets/corporate_report/css/report_rtl.css +0 -4
- package/config/sanusx.json +2 -2
- package/index.js +14 -19
- package/lib/corporate_report_generator.js +5 -13
- package/package.json +2 -4
- package/templates/corporate_report/page.html +1 -0
- package/assets/xorcrypt12.js +0 -217
- package/lib/encrypt_decrypt.js +0 -58
|
@@ -34,16 +34,14 @@ body {
|
|
|
34
34
|
|
|
35
35
|
.participant-analytics-section.single-section.page {
|
|
36
36
|
background-color: #fff;
|
|
37
|
-
margin-top: -
|
|
37
|
+
margin-top: -65px;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.bottom-section {
|
|
41
41
|
display: block;
|
|
42
42
|
width: 100%;
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
float: left;
|
|
45
|
-
margin-top:3%;
|
|
46
|
-
page-break-before: avoid;
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
.page .relations-section-container {
|
|
@@ -228,7 +226,9 @@ td.bar-title span {
|
|
|
228
226
|
color: rgb(51, 51, 51);
|
|
229
227
|
text-align: right;
|
|
230
228
|
direction: ltr;
|
|
229
|
+
text-transform: capitalize
|
|
231
230
|
}
|
|
231
|
+
|
|
232
232
|
/*
|
|
233
233
|
.participant-analytics-section .container .side-chart-container:nth-child(odd) .bar-title span {
|
|
234
234
|
text-align: left;
|
|
@@ -390,23 +390,19 @@ td {
|
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
.relations-section .single-relation {
|
|
393
|
-
width:
|
|
393
|
+
width: 30%;
|
|
394
394
|
float: left;
|
|
395
395
|
padding: 1% 1% 0% 1%;
|
|
396
396
|
box-sizing: border-box;
|
|
397
397
|
color: rgb(0, 0, 153);
|
|
398
398
|
margin-right: 3%;
|
|
399
|
-
margin-bottom: 3%;
|
|
400
|
-
}
|
|
401
|
-
.relations-section .single-relation:nth-child(even){
|
|
402
|
-
margin-right: 0
|
|
403
399
|
}
|
|
404
|
-
|
|
400
|
+
|
|
405
401
|
.relations-section .single-relation:nth-child(4n) {
|
|
406
402
|
margin-right: 5%;
|
|
407
403
|
width: 30%;
|
|
408
404
|
}
|
|
409
|
-
|
|
405
|
+
|
|
410
406
|
.relation-title {
|
|
411
407
|
font-weight: 600;
|
|
412
408
|
font-size: 83%;
|
|
@@ -449,14 +445,12 @@ table.data-by-gender {
|
|
|
449
445
|
margin-top: 3%;
|
|
450
446
|
float: left;
|
|
451
447
|
text-align: left;
|
|
452
|
-
font-size:
|
|
448
|
+
font-size: 91%;
|
|
453
449
|
border-spacing: 0;
|
|
454
450
|
margin-bottom: 6%;
|
|
455
451
|
page-break-inside: avoid;
|
|
456
452
|
}
|
|
457
|
-
|
|
458
|
-
font-size: 12px;
|
|
459
|
-
}
|
|
453
|
+
|
|
460
454
|
table.data-by-gender tr th:first-child {
|
|
461
455
|
width: 20%;
|
|
462
456
|
}
|
|
@@ -465,9 +459,6 @@ table.data-by-gender tr td {
|
|
|
465
459
|
color: rgb(51, 51, 51);
|
|
466
460
|
font-size: 80%;
|
|
467
461
|
}
|
|
468
|
-
table.data-by-gender tr:first-child td{
|
|
469
|
-
border-bottom: 1px solid #5F9CC8;
|
|
470
|
-
}
|
|
471
462
|
|
|
472
463
|
table.data-by-gender th {
|
|
473
464
|
color: rgb(139, 139, 167);
|
|
@@ -479,33 +470,19 @@ table.data-by-gender th {
|
|
|
479
470
|
table.data-by-gender tbody tr:first-child td {
|
|
480
471
|
color: rgb(139, 139, 167);
|
|
481
472
|
font-weight: 600;
|
|
482
|
-
font-size:
|
|
483
|
-
}
|
|
484
|
-
table.data-by-gender tbody tr:first-child td:first-child{
|
|
485
|
-
color: rgba(51, 51, 51, 1) !important;
|
|
486
|
-
font-weight: 600;
|
|
487
|
-
font-size: 10px;
|
|
473
|
+
font-size: 9px;
|
|
488
474
|
}
|
|
475
|
+
|
|
489
476
|
table.data-by-gender td, table.data-by-gender th {
|
|
490
477
|
padding: 4px;
|
|
491
478
|
}
|
|
492
|
-
|
|
493
|
-
table.data-by-gender
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
table.data-by-gender th:nth-child(2),
|
|
497
|
-
table.data-by-gender th:nth-child(3),
|
|
498
|
-
table.data-by-gender tbody tr td:nth-child(6),
|
|
499
|
-
table.data-by-gender tbody tr td:nth-child(11){
|
|
500
|
-
border-right: 1px solid rgba(98, 142, 171, 1)
|
|
479
|
+
|
|
480
|
+
table.data-by-gender tbody tr:nth-child(even) {
|
|
481
|
+
background-color: rgb(237, 237, 248);
|
|
501
482
|
}
|
|
502
483
|
|
|
503
484
|
table.data-by-gender tr td:last-child {
|
|
504
485
|
text-align: center;
|
|
505
|
-
color:rgba(98, 142, 171, 1)
|
|
506
|
-
}
|
|
507
|
-
table.data-by-gender tr td:not(:first-child) {
|
|
508
|
-
text-align: center;
|
|
509
486
|
}
|
|
510
487
|
|
|
511
488
|
.recommends-section {
|
|
@@ -519,7 +496,6 @@ table.data-by-gender tr td:not(:first-child) {
|
|
|
519
496
|
transform: skewY(3deg);
|
|
520
497
|
border-top-right-radius: 20px;
|
|
521
498
|
border-bottom-right-radius: 20px;
|
|
522
|
-
page-break-inside: avoid;
|
|
523
499
|
}
|
|
524
500
|
|
|
525
501
|
.recommends-section-content {
|
package/config/sanusx.json
CHANGED
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"corporate_report":{
|
|
21
21
|
"logo": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQsAAABkCAYAAACRgBVpAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABJCSURBVHgB7Z1NdtRIEscjVeBednEC1Lt5bxaYE1AsZ0XZ3Ta9a3MC4ASYEwAnwOx6zDSuPgHmBG0W817vKE6A2Q02Vk78I6X6UqZKKkm4ZO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+I5tITOBb/zoPNg9CokLqhZ5+JIPJFTZudmhibto/UM55EX0N7kXHXSQ4ZrmfC5xDFLJINeSdyPIH2xcc3EBeEhfNwiHv6c1rW3HdJ/LFMOoJOQ7oGomAZVnOhJmdqtsz9EQ8j3Uotu13FrnFXRtIoGslojBUTZAE7o0d0eATD6IlMXTAPN5LwJ5b7sWV+GZI8eck959JRYtYwBpN6To2M78UZDfWTTONc9y+BiGAmTRT9v1Tw+DagIfsa8p5gR6cz+u55pyHZ9AJaD7GgOpMUAMciTM/tA2kz1CWLJp7wNAK2DRyXXaep2z6MzLCL4LiJ9mXq4TSZExF6rpzHUlbIdX8dVrAqoMKia+CFlFGNX84N84lHc8vC45kEycnU8x7U5ySWcxuYGlw4T10x2rG6nt2HZcezNGeq5Rcbc3g5bgdL6yFaDT+z6B6Um7AgSMzLST0zLUGC46Z1kTry6LxsN2gWIRzXo7xZ/wqTPJWOnH1njPS+8rJrYKNAm0HTcKEO/hQ7BM7N7uMx8ry3af2fpAFxKK2HO54gRWQaKiHi75s9w5jwUi2mJj1TM9myolxlYCdYtyjsiqKsATtbf02mDbJ6s7VqfA/lklEDp9IuCU8HnLoek9t+/5gURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVG6yv8B4DAXEI5JP88AAAAASUVORK5CYII=",
|
|
22
22
|
"main_color": "rgb(23, 107, 97)",
|
|
23
|
-
"report_date_color": "
|
|
23
|
+
"report_date_color": "rgb(139, 139, 167)",
|
|
24
24
|
"section_title_color": "rgb(23, 107, 97)",
|
|
25
25
|
"section_title_border_color": "rgb(112, 162, 147)",
|
|
26
26
|
"chart_title": "rgb(139, 139, 167)",
|
|
27
27
|
"summary_background":"#e5f5fc",
|
|
28
|
-
"relation_content_border_color":"rgba(
|
|
28
|
+
"relation_content_border_color":"rgba(0, 0, 153, 0.3)",
|
|
29
29
|
"relation_content_bg":"#f2f2ff",
|
|
30
30
|
"table_tr_even_bg":"rgb(237, 237, 248)",
|
|
31
31
|
"recommends_bg":"rgba(0, 0, 153, 0.05)",
|
package/index.js
CHANGED
|
@@ -5,8 +5,6 @@ const {fork} = require('child_process');
|
|
|
5
5
|
const {join} = require('path');
|
|
6
6
|
const {sendNascoEmail, sendEmailNotification} = require('./lib/sendEmail')
|
|
7
7
|
const {generatePDFCorporateReport, generateHTMLCorporateReport} = require('./lib/corporate_report_generator')
|
|
8
|
-
const encryptDecrypt = require('./lib/encrypt_decrypt');
|
|
9
|
-
|
|
10
8
|
module.exports = {
|
|
11
9
|
generateHTMLStaging,
|
|
12
10
|
generateMedicusPDF: async (base64Object, isDebugging, isDownloadable, onlyHTML) => {
|
|
@@ -89,14 +87,8 @@ module.exports = {
|
|
|
89
87
|
|
|
90
88
|
},
|
|
91
89
|
generateNascoPDF: async (data, isDebugging, isDownloadable, shouldSendEmail) => {
|
|
92
|
-
|
|
93
90
|
let reportData = JSON.parse(data)
|
|
94
|
-
let
|
|
95
|
-
let sentData=reportData.data
|
|
96
|
-
let ecbDecrypted = encryptDecrypt.ecbDecrypt(sentData, encryptionKey)
|
|
97
|
-
|
|
98
|
-
let xorDecrypted = encryptDecrypt.XORDecrypt(ecbDecrypted.toString(), encryptionKey)
|
|
99
|
-
console.log("xorDecrypted",xorDecrypted)
|
|
91
|
+
let base64Object = reportData.data
|
|
100
92
|
let LOGS = '';
|
|
101
93
|
let LOGS_FILE_PATH = __dirname + '/output/LOGS.txt';
|
|
102
94
|
let PDF_FILE_PATH = __dirname + '/output/nasco-sample.pdf';
|
|
@@ -122,11 +114,18 @@ module.exports = {
|
|
|
122
114
|
if (isDebugging) {
|
|
123
115
|
console.log('2: save json string');
|
|
124
116
|
LOGS += '2: save json string' + '\n' + '=============' + '\n';
|
|
125
|
-
LOGS +=
|
|
117
|
+
LOGS += base64Object + '\n\n\n';
|
|
118
|
+
}
|
|
119
|
+
// 2: save decoded json string
|
|
120
|
+
const json = Buffer.from(base64Object, 'base64').toString('utf8');
|
|
121
|
+
if (isDebugging) {
|
|
122
|
+
console.log('2: save decoded json string');
|
|
123
|
+
LOGS += '2: save decoded json string' + '\n' + '=============' + '\n';
|
|
124
|
+
LOGS += json + '\n\n\n';
|
|
126
125
|
}
|
|
127
126
|
|
|
128
127
|
// 3: save decoded json
|
|
129
|
-
const decodedJSON = JSON.parse(
|
|
128
|
+
const decodedJSON = JSON.parse(json);
|
|
130
129
|
if (isDebugging) {
|
|
131
130
|
console.log('3: save decoded json string')
|
|
132
131
|
LOGS += '3: save decoded json' + '\n' + '=============' + '\n';
|
|
@@ -166,13 +165,9 @@ module.exports = {
|
|
|
166
165
|
return fileBuffer;
|
|
167
166
|
} else {
|
|
168
167
|
if (shouldSendEmail)
|
|
169
|
-
|
|
170
|
-
else
|
|
171
|
-
|
|
172
|
-
let ecbEncrypted = encryptDecrypt.ecbEncrypt(xorEncrypted.toString(), encryptionKey)
|
|
173
|
-
return ecbEncrypted;
|
|
174
|
-
}
|
|
175
|
-
|
|
168
|
+
return await sendNascoEmail(decodedJSON, PDF_FILE_PATH, mailConfig,reportData.client)
|
|
169
|
+
else
|
|
170
|
+
return base64data;
|
|
176
171
|
}
|
|
177
172
|
},
|
|
178
173
|
sendEmail: async (json) => {
|
|
@@ -218,7 +213,7 @@ module.exports = {
|
|
|
218
213
|
|
|
219
214
|
|
|
220
215
|
let html = await generateHTMLCorporateReport(decodedJSON, isDebugging);
|
|
221
|
-
|
|
216
|
+
|
|
222
217
|
|
|
223
218
|
// 3: save PDF buffer
|
|
224
219
|
let fileBuffer = await generatePDFCorporateReport(html);
|
|
@@ -141,7 +141,7 @@ let generateHTMLCorporateReport = async (data, isDebugging) => {
|
|
|
141
141
|
'.element-summary-text,.summary-bg{background: ' + summary_background + ' !important;}' +
|
|
142
142
|
'.relation-content,table.data-by-gender th{border-color: ' + relation_content_border_color + ' !important;}' +
|
|
143
143
|
'.relation-content{background: ' + relation_content_bg + ' !important;}' +
|
|
144
|
-
|
|
144
|
+
'table.data-by-gender tbody tr:nth-child(even){background-color: ' + table_tr_even_bg + ' !important;}' +
|
|
145
145
|
'.report-date,table.data-by-gender th,table.data-by-gender tbody tr:first-child td,.sources-title{color: ' + report_date_color + ' !important;}' +
|
|
146
146
|
'.recommends-section{background: ' + recommends_bg + ' !important;}' +
|
|
147
147
|
|
|
@@ -174,7 +174,7 @@ let generateHTMLCorporateReport = async (data, isDebugging) => {
|
|
|
174
174
|
}
|
|
175
175
|
/*check relations*/
|
|
176
176
|
if (!empty(element.relations)) {
|
|
177
|
-
console.log("element.relations",
|
|
177
|
+
console.log("element.relations",element.relations.length)
|
|
178
178
|
element.relations.map((relation) => {
|
|
179
179
|
$("#" + pageId + " .relations-section-container .relations-section-titles").append("<div class='single-relation'>" +
|
|
180
180
|
"<div class='relation-title'>" + relation.title + "</div>" +
|
|
@@ -197,18 +197,10 @@ let generateHTMLCorporateReport = async (data, isDebugging) => {
|
|
|
197
197
|
})
|
|
198
198
|
tabelHeaderHTML += '</thead>'
|
|
199
199
|
let tabelBody = element.dataByGender.slice(1)
|
|
200
|
-
let dataByGenderHTML = '<tbody>'
|
|
201
|
-
let countTrs = 0
|
|
200
|
+
let dataByGenderHTML = '<tbody>'
|
|
202
201
|
tabelBody.map((genderData) => {
|
|
203
|
-
countTrs = countTrs + 1;
|
|
204
202
|
dataByGenderHTML += "<tr>"
|
|
205
|
-
let CountTds = 0
|
|
206
203
|
genderData.map((td) => {
|
|
207
|
-
CountTds++;
|
|
208
|
-
let colSpan = 1
|
|
209
|
-
if (CountTds === 1 && countTrs ===1) {
|
|
210
|
-
colSpan = 2
|
|
211
|
-
}
|
|
212
204
|
dataByGenderHTML += "<td>" + td.value + "</td>"
|
|
213
205
|
})
|
|
214
206
|
dataByGenderHTML += "</tr>"
|
|
@@ -217,7 +209,7 @@ let generateHTMLCorporateReport = async (data, isDebugging) => {
|
|
|
217
209
|
$("#" + pageId + " .data-by-gender").append(tabelHeaderHTML);
|
|
218
210
|
$("#" + pageId + " .data-by-gender").append(dataByGenderHTML);
|
|
219
211
|
} else {
|
|
220
|
-
|
|
212
|
+
$("#" + pageId + " .data-by-gender").remove();
|
|
221
213
|
}
|
|
222
214
|
|
|
223
215
|
if (!empty(element.recommends)) {
|
|
@@ -317,7 +309,7 @@ let generatePDFCorporateReport = async (data) => {
|
|
|
317
309
|
displayHeaderFooter: true,
|
|
318
310
|
margin: {
|
|
319
311
|
top: 0,
|
|
320
|
-
bottom:
|
|
312
|
+
bottom: 60,
|
|
321
313
|
right: 0,
|
|
322
314
|
left: 0
|
|
323
315
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medicus.ai/medicus-report-pdf-generator",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Nasco corporate report - latest update in
|
|
3
|
+
"version": "1.0.232",
|
|
4
|
+
"description": "Nasco corporate report - latest update in 17/11/2023 - Fix sanusx coprorate report issues",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "node index.js"
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
"canvas": "^2.6.1",
|
|
17
17
|
"canvas-constructor": "^3.2.0",
|
|
18
18
|
"chart.js": "^2.7.3",
|
|
19
|
-
"crypto-js": "^4.1.1",
|
|
20
19
|
"express": "^4.16.4",
|
|
21
20
|
"get-canvas-context": "^1.0.2",
|
|
22
21
|
"hummus": "1.0.111",
|
|
@@ -36,7 +35,6 @@
|
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"@babel/core": "^7.2.2",
|
|
39
|
-
"atob": "^2.1.2",
|
|
40
38
|
"babel-core": "^6.26.3",
|
|
41
39
|
"babel-loader": "^8.0.5",
|
|
42
40
|
"babel-polyfill": "^6.26.0",
|
package/assets/xorcrypt12.js
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
This Javascript will en/decrypt a string using the HTML XOR algorithim
|
|
3
|
-
XORCRYPT Version 1.2
|
|
4
|
-
|
|
5
|
-
This version is much faster because it does not use Base64 encoding.
|
|
6
|
-
It is also more difficult to crack, because the key is as long as the
|
|
7
|
-
password, and the only way to hack it is to try every possible password.
|
|
8
|
-
|
|
9
|
-
The latest version has some small bugs cleaned up, reorganized decrypt
|
|
10
|
-
sequence and is now crossplatform, crossbrowser compatible, with the
|
|
11
|
-
exception of Netscape 2.X. It would be possible to make it compatible
|
|
12
|
-
with Netscape 2.X, but I see no point.
|
|
13
|
-
|
|
14
|
-
For more information on this very simple algorithim email me.
|
|
15
|
-
|
|
16
|
-
This script was written by:
|
|
17
|
-
Evan Jones, 1997
|
|
18
|
-
jonesev@home.com
|
|
19
|
-
You may use this script any way you wish as long as you email me and let me know.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/* Create the encrypt table */
|
|
23
|
-
// The last char in the table is always the escape code
|
|
24
|
-
// The table is not quite 128 chars, it is 95 (minus the escape char)
|
|
25
|
-
// Values 93-127 must be escaped
|
|
26
|
-
|
|
27
|
-
var cryptTable=new String(" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 !@#$%^&*()`'-=[];,./?_+{}|:<>~");
|
|
28
|
-
var cryptLength=new Number(cryptTable.length-1) //93 Chars
|
|
29
|
-
var escapeChar=cryptTable.charAt(cryptLength); // The escape code is ~
|
|
30
|
-
|
|
31
|
-
var lineFeed="\n"; //The linefeed char - escaped to double escapeChar
|
|
32
|
-
var doubleQuote='"'; //Double quotes are escaped to ~'
|
|
33
|
-
var clearMessage=new Number(5000); //The number of ms to wait to clear the status bar message
|
|
34
|
-
|
|
35
|
-
/* This function uses the key and encrypts a string with the password */
|
|
36
|
-
// Encryption strips all linefeeds - but they are replaced upon decrypt
|
|
37
|
-
function encrypt(input, password)
|
|
38
|
-
{
|
|
39
|
-
var inChar, inValue, outValue;
|
|
40
|
-
|
|
41
|
-
var output="";
|
|
42
|
-
var arNumberPw = new Array();
|
|
43
|
-
|
|
44
|
-
var pwLength=password.length;
|
|
45
|
-
var inLength=input.length;
|
|
46
|
-
|
|
47
|
-
var stopStatus=Math.round(inLength/10);
|
|
48
|
-
var statusBar=0;
|
|
49
|
-
|
|
50
|
-
for (var pwIndex=0; pwIndex<pwLength; pwIndex++)
|
|
51
|
-
{
|
|
52
|
-
arNumberPw[pwIndex]=cryptTable.indexOf(password.charAt(pwIndex));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/* XOR all the chars */
|
|
56
|
-
for (var inIndex=0, pwIndex=0; inIndex<inLength; inIndex++, pwIndex++)
|
|
57
|
-
{
|
|
58
|
-
if (pwIndex==pwLength) //Make sure the password index is in range
|
|
59
|
-
{
|
|
60
|
-
pwIndex=0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/* Get the input */
|
|
64
|
-
|
|
65
|
-
inChar=input.charAt(inIndex)
|
|
66
|
-
inValue=cryptTable.indexOf(inChar);
|
|
67
|
-
|
|
68
|
-
/* Conversion/Escaping Sequence */
|
|
69
|
-
// If the outValue is in the character map, encode it
|
|
70
|
-
// If the encoded value is outside the character map, escape it
|
|
71
|
-
// Else convert it to a char
|
|
72
|
-
// If the input char is a linefeed, escape it
|
|
73
|
-
// If the input char is a double quote, escape it
|
|
74
|
-
// If the input char wasn't found, pass it through
|
|
75
|
-
|
|
76
|
-
if (inValue!=-1)
|
|
77
|
-
{
|
|
78
|
-
outValue=arNumberPw[pwIndex] ^ inValue;
|
|
79
|
-
if (outValue>=cryptLength)
|
|
80
|
-
{
|
|
81
|
-
outValue=escapeChar+cryptTable.charAt(outValue-cryptLength);
|
|
82
|
-
}
|
|
83
|
-
else outValue=cryptTable.charAt(outValue);
|
|
84
|
-
}
|
|
85
|
-
else if (inChar=="\r")
|
|
86
|
-
{
|
|
87
|
-
outValue=escapeChar+escapeChar;
|
|
88
|
-
if (input.charAt(inIndex+1)=="\n") inIndex++; //If it is a 2 char linefeed skip next one
|
|
89
|
-
}
|
|
90
|
-
else if (inChar=="\n")
|
|
91
|
-
{
|
|
92
|
-
outValue=escapeChar+escapeChar;
|
|
93
|
-
}
|
|
94
|
-
else if (inChar==doubleQuote)
|
|
95
|
-
{
|
|
96
|
-
outValue=escapeChar+"'";
|
|
97
|
-
}
|
|
98
|
-
else
|
|
99
|
-
{
|
|
100
|
-
outValue=inChar;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
output+=outValue; //Output the char
|
|
104
|
-
|
|
105
|
-
/* Status bar progress indicator */
|
|
106
|
-
|
|
107
|
-
if (inIndex>=statusBar)
|
|
108
|
-
{
|
|
109
|
-
window.status=inIndex+"/"+inLength+" characters decrypted ("+Math.round(inIndex/inLength*100)+"%)";
|
|
110
|
-
statusBar+=stopStatus;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
window.status=inLength+"/"+inLength+" characters encrypted (100%)";
|
|
115
|
-
setTimeout("window.status=''", clearMessage);
|
|
116
|
-
|
|
117
|
-
return output;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/* This function uses the key and encrypts a string with the password */
|
|
122
|
-
|
|
123
|
-
function decrypt(input, password)
|
|
124
|
-
{
|
|
125
|
-
var inChar, inValue, outValue, escape=false;
|
|
126
|
-
|
|
127
|
-
var output="";
|
|
128
|
-
var arNumberPw = new Array();
|
|
129
|
-
|
|
130
|
-
var pwLength=password.length;
|
|
131
|
-
var inLength=input.length;
|
|
132
|
-
|
|
133
|
-
var stopStatus=Math.round(inLength/10);
|
|
134
|
-
var statusBar=0;
|
|
135
|
-
|
|
136
|
-
for (var pwIndex=0; pwIndex<pwLength; pwIndex++)
|
|
137
|
-
{
|
|
138
|
-
arNumberPw[pwIndex]=cryptTable.indexOf(password.charAt(pwIndex));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/* XOR all the chars */
|
|
142
|
-
for (var inIndex=0, pwIndex=0; inIndex<inLength; inIndex++, pwIndex++)
|
|
143
|
-
{
|
|
144
|
-
if (pwIndex>=pwLength) //Make sure the password index is in range
|
|
145
|
-
{
|
|
146
|
-
pwIndex=0;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/* Get the input */
|
|
150
|
-
inChar=input.charAt(inIndex);
|
|
151
|
-
inValue=cryptTable.indexOf(inChar);
|
|
152
|
-
|
|
153
|
-
/* Decrypting/Unescaping Sequence */
|
|
154
|
-
// If the input char wasn't found, pass it through (error checking)
|
|
155
|
-
// If the last char was an escapeChar
|
|
156
|
-
//And the input is an escapeChar, output a linefeed
|
|
157
|
-
//Or the input is a single quote, output a double quote
|
|
158
|
-
//Otherwise just add the cryptLength to the inValue
|
|
159
|
-
//Turn escape off
|
|
160
|
-
// If the inValue hasn't been coverted to an outValue yet
|
|
161
|
-
// If the inChar is an escapeChar, turn escape on
|
|
162
|
-
// Otherwise decrypt the encrypted character
|
|
163
|
-
|
|
164
|
-
if (inValue==-1)
|
|
165
|
-
{
|
|
166
|
-
outValue=inChar;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
else if (escape)
|
|
170
|
-
{
|
|
171
|
-
if (inValue==cryptLength)
|
|
172
|
-
{
|
|
173
|
-
outValue=lineFeed;
|
|
174
|
-
inValue=-1;
|
|
175
|
-
}
|
|
176
|
-
else if (inChar=="'")
|
|
177
|
-
{
|
|
178
|
-
outValue=doubleQuote;
|
|
179
|
-
inValue=-1;
|
|
180
|
-
}
|
|
181
|
-
else
|
|
182
|
-
{
|
|
183
|
-
inValue+=cryptLength;
|
|
184
|
-
}
|
|
185
|
-
escape=false;
|
|
186
|
-
}
|
|
187
|
-
else if (inValue==cryptLength)
|
|
188
|
-
{
|
|
189
|
-
escape=true;
|
|
190
|
-
pwIndex--; //Stop the password from incrementing
|
|
191
|
-
outValue="";
|
|
192
|
-
inValue=-1;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (inValue!=-1)
|
|
196
|
-
{
|
|
197
|
-
outValue=cryptTable.charAt(arNumberPw[pwIndex] ^ inValue);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/* Output */
|
|
201
|
-
|
|
202
|
-
output+=outValue;
|
|
203
|
-
|
|
204
|
-
/* Status bar progress indicator */
|
|
205
|
-
|
|
206
|
-
if (inIndex>=statusBar)
|
|
207
|
-
{
|
|
208
|
-
window.status=inIndex+"/"+inLength+" characters decrypted ("+Math.round(inIndex/inLength*100)+"%)";
|
|
209
|
-
statusBar+=stopStatus;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
window.status=inLength+"/"+inLength+" characters decrypted (100%)";
|
|
214
|
-
setTimeout("window.status=''", clearMessage);
|
|
215
|
-
|
|
216
|
-
return output;
|
|
217
|
-
}
|
package/lib/encrypt_decrypt.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
const CryptoJS = require('crypto-js');
|
|
2
|
-
var atob = require('atob');
|
|
3
|
-
|
|
4
|
-
function ecbEncrypt(data, key) {
|
|
5
|
-
let encJson = CryptoJS.AES.encrypt(JSON.stringify(data), key).toString();
|
|
6
|
-
return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(encJson));
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function ecbDecrypt(data, key) {
|
|
10
|
-
var keys = CryptoJS.enc.Utf8.parse(key);
|
|
11
|
-
let base64 = CryptoJS.enc.Base64.parse(data);
|
|
12
|
-
let src = CryptoJS.enc.Base64.stringify(base64);
|
|
13
|
-
var decrypt = CryptoJS.AES.decrypt(src, keys, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7});
|
|
14
|
-
return decrypt.toString(CryptoJS.enc.Utf8);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function XORDecrypt(input, key) {
|
|
19
|
-
var decodedText = atob(input);
|
|
20
|
-
var plainText = '';
|
|
21
|
-
var length = decodedText.length;
|
|
22
|
-
|
|
23
|
-
for (var i = 0; i < length; i++) {
|
|
24
|
-
plainText += String.fromCharCode(decodedText.charCodeAt(i) ^ key.charCodeAt(Math.floor(i % key.length)));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return plainText;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function XOREncrypt(input, key){
|
|
31
|
-
var c = '';
|
|
32
|
-
while (key.length < input.length) {
|
|
33
|
-
key += key;
|
|
34
|
-
}
|
|
35
|
-
for(var i=0; i<input.length; i++) {
|
|
36
|
-
var value1 = input[i].charCodeAt(0);
|
|
37
|
-
var value2 = key[i].charCodeAt(0);
|
|
38
|
-
|
|
39
|
-
var xorValue = value1 ^ value2;
|
|
40
|
-
|
|
41
|
-
var xorValueAsHexString = xorValue.toString("16");
|
|
42
|
-
|
|
43
|
-
if (xorValueAsHexString.length < 2) {
|
|
44
|
-
xorValueAsHexString = "0" + xorValueAsHexString;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
c += xorValueAsHexString;
|
|
48
|
-
}
|
|
49
|
-
return c;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
module.exports =
|
|
53
|
-
{
|
|
54
|
-
ecbEncrypt,
|
|
55
|
-
ecbDecrypt,
|
|
56
|
-
XORDecrypt,
|
|
57
|
-
XOREncrypt
|
|
58
|
-
}
|