@ddunigma/node 1.0.21 → 1.0.23
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/cjs/index.js +6 -4
- package/dist/cjs/test/test3.d.ts +1 -0
- package/dist/cjs/test/test3.js +20 -0
- package/dist/mjs/index.js +6 -4
- package/dist/mjs/test/test3.d.ts +1 -0
- package/dist/mjs/test/test3.js +18 -0
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -21,7 +21,8 @@ class Ddu64 {
|
|
|
21
21
|
this.dduBinaryLookupKr = new Map();
|
|
22
22
|
this.paddingRegex = new Map();
|
|
23
23
|
if (typeof dduChar === "string") {
|
|
24
|
-
|
|
24
|
+
const removeDuplicatesString = [...new Set(dduChar.trim())].join("");
|
|
25
|
+
this.dduChar = removeDuplicatesString.trim().split("");
|
|
25
26
|
}
|
|
26
27
|
else {
|
|
27
28
|
this.dduChar = dduChar || this.dduCharKr;
|
|
@@ -212,7 +213,8 @@ class Custom64 {
|
|
|
212
213
|
this.dduBinaryLookupKr = new Map();
|
|
213
214
|
this.paddingRegex = new Map();
|
|
214
215
|
if (typeof dduChar === "string") {
|
|
215
|
-
|
|
216
|
+
const removeDuplicatesString = [...new Set(dduChar.trim())].join("");
|
|
217
|
+
this.dduChar = removeDuplicatesString.trim().split("");
|
|
216
218
|
}
|
|
217
219
|
else {
|
|
218
220
|
this.dduChar = dduChar || this.dduCharKr;
|
|
@@ -277,7 +279,7 @@ class Custom64 {
|
|
|
277
279
|
return Buffer.from(buffer);
|
|
278
280
|
}
|
|
279
281
|
encode(input, options = {}) {
|
|
280
|
-
const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo =
|
|
282
|
+
const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = true, } = options;
|
|
281
283
|
const bufferInput = typeof input === "string" ? Buffer.from(input, encoding) : input;
|
|
282
284
|
const { dduSet, padChar, dduLength, bitLength } = this.getSelectedSets(dduSetSymbol, usePowerOfTwo);
|
|
283
285
|
const { dduBinary, padding } = this.bufferToDduBinary(bufferInput, bitLength);
|
|
@@ -298,7 +300,7 @@ class Custom64 {
|
|
|
298
300
|
: resultString;
|
|
299
301
|
}
|
|
300
302
|
decode(input, options = {}) {
|
|
301
|
-
const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo =
|
|
303
|
+
const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = true, } = options;
|
|
302
304
|
const { dduSet, dduLength, bitLength, lookupTable, paddingRegExp } = this.getSelectedSets(dduSetSymbol, usePowerOfTwo);
|
|
303
305
|
const paddingCount = (input.match(paddingRegExp) || []).length;
|
|
304
306
|
const paddingBits = paddingCount * 2;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const __1 = require("..");
|
|
4
|
+
const secret = "Asqr0z3ty1524EBCQFRTUWVXYZbacdD+GLHIJKMONfehgPiSklmujvnop9w678x/";
|
|
5
|
+
const padding = "=";
|
|
6
|
+
function encryptDdu64(content) {
|
|
7
|
+
const custom64 = new __1.Custom64();
|
|
8
|
+
const encoded = custom64.encode(content, { usePowerOfTwo: true });
|
|
9
|
+
return encoded;
|
|
10
|
+
}
|
|
11
|
+
function decryptDdu64(content) {
|
|
12
|
+
const custom64 = new __1.Custom64();
|
|
13
|
+
const decoded = custom64.decode(content, { usePowerOfTwo: true });
|
|
14
|
+
return decoded;
|
|
15
|
+
}
|
|
16
|
+
console.log("타운카 너무좋아123");
|
|
17
|
+
console.log("");
|
|
18
|
+
console.log(encryptDdu64("타운카 너무좋아123"));
|
|
19
|
+
console.log("");
|
|
20
|
+
console.log(decryptDdu64(encryptDdu64("타운카 너무좋아123")));
|
package/dist/mjs/index.js
CHANGED
|
@@ -20,7 +20,8 @@ export class Ddu64 {
|
|
|
20
20
|
paddingRegex = new Map();
|
|
21
21
|
constructor(dduChar, paddingChar) {
|
|
22
22
|
if (typeof dduChar === "string") {
|
|
23
|
-
|
|
23
|
+
const removeDuplicatesString = [...new Set(dduChar.trim())].join("");
|
|
24
|
+
this.dduChar = removeDuplicatesString.trim().split("");
|
|
24
25
|
}
|
|
25
26
|
else {
|
|
26
27
|
this.dduChar = dduChar || this.dduCharKr;
|
|
@@ -212,7 +213,8 @@ export class Custom64 {
|
|
|
212
213
|
paddingRegex = new Map();
|
|
213
214
|
constructor(dduChar, paddingChar) {
|
|
214
215
|
if (typeof dduChar === "string") {
|
|
215
|
-
|
|
216
|
+
const removeDuplicatesString = [...new Set(dduChar.trim())].join("");
|
|
217
|
+
this.dduChar = removeDuplicatesString.trim().split("");
|
|
216
218
|
}
|
|
217
219
|
else {
|
|
218
220
|
this.dduChar = dduChar || this.dduCharKr;
|
|
@@ -277,7 +279,7 @@ export class Custom64 {
|
|
|
277
279
|
return Buffer.from(buffer);
|
|
278
280
|
}
|
|
279
281
|
encode(input, options = {}) {
|
|
280
|
-
const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo =
|
|
282
|
+
const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = true, } = options;
|
|
281
283
|
const bufferInput = typeof input === "string" ? Buffer.from(input, encoding) : input;
|
|
282
284
|
const { dduSet, padChar, dduLength, bitLength } = this.getSelectedSets(dduSetSymbol, usePowerOfTwo);
|
|
283
285
|
const { dduBinary, padding } = this.bufferToDduBinary(bufferInput, bitLength);
|
|
@@ -298,7 +300,7 @@ export class Custom64 {
|
|
|
298
300
|
: resultString;
|
|
299
301
|
}
|
|
300
302
|
decode(input, options = {}) {
|
|
301
|
-
const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo =
|
|
303
|
+
const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = true, } = options;
|
|
302
304
|
const { dduSet, dduLength, bitLength, lookupTable, paddingRegExp } = this.getSelectedSets(dduSetSymbol, usePowerOfTwo);
|
|
303
305
|
const paddingCount = (input.match(paddingRegExp) || []).length;
|
|
304
306
|
const paddingBits = paddingCount * 2;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Custom64 } from "..";
|
|
2
|
+
const secret = "Asqr0z3ty1524EBCQFRTUWVXYZbacdD+GLHIJKMONfehgPiSklmujvnop9w678x/";
|
|
3
|
+
const padding = "=";
|
|
4
|
+
function encryptDdu64(content) {
|
|
5
|
+
const custom64 = new Custom64();
|
|
6
|
+
const encoded = custom64.encode(content, { usePowerOfTwo: true });
|
|
7
|
+
return encoded;
|
|
8
|
+
}
|
|
9
|
+
function decryptDdu64(content) {
|
|
10
|
+
const custom64 = new Custom64();
|
|
11
|
+
const decoded = custom64.decode(content, { usePowerOfTwo: true });
|
|
12
|
+
return decoded;
|
|
13
|
+
}
|
|
14
|
+
console.log("타운카 너무좋아123");
|
|
15
|
+
console.log("");
|
|
16
|
+
console.log(encryptDdu64("타운카 너무좋아123"));
|
|
17
|
+
console.log("");
|
|
18
|
+
console.log(decryptDdu64(encryptDdu64("타운카 너무좋아123")));
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddunigma/node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/mjs/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "rm -rf dist/* && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && sh postProcess.sh",
|
|
10
|
-
"test": "tsx ./src/test/
|
|
10
|
+
"test": "tsx ./src/test/test3.ts",
|
|
11
11
|
"tester": "echo tester2 && tsx ./src/test/tester2.ts && echo tester && tsx ./src/test/tester.ts"
|
|
12
12
|
},
|
|
13
13
|
"exports": {
|